mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-29 09:24:36 +00:00
Documents idetools skLabel with failure test case.
This commit is contained in:
@@ -295,6 +295,22 @@ posterior instances of the iterator.
|
||||
col 7: "iterates over any unicode character of the string `s`."
|
||||
|
||||
|
||||
skLabel
|
||||
-------
|
||||
|
||||
| **Third column**: module + [n scope nesting] + name.
|
||||
| **Fourth column**: always the empty string.
|
||||
| **Docstring**: always the empty string.
|
||||
|
||||
.. code-block:: nimrod
|
||||
proc test(text: string) =
|
||||
var found = -1
|
||||
block loops:
|
||||
--> col 2: $MODULE.test.loops
|
||||
col 3: ""
|
||||
col 7: ""
|
||||
|
||||
|
||||
skLet
|
||||
-----
|
||||
|
||||
|
||||
@@ -41,3 +41,15 @@ proc newLit(x: int): PLiteral = PLiteral(x: x)
|
||||
proc newPlus(a, b: PExpr): PPlusExpr = PPlusExpr(a: a, b: b)
|
||||
|
||||
echo eval(newPlus(newPlus(newLit(1), newLit(2)), newLit(4)))
|
||||
|
||||
proc findVowelPosition(text: string) =
|
||||
var found = -1
|
||||
block loops:
|
||||
for i, letter in pairs(text):
|
||||
for j in ['a', 'e', 'i', 'o', 'u']:
|
||||
if letter == j:
|
||||
found = i
|
||||
break loops # leave both for-loops
|
||||
echo found
|
||||
|
||||
findVowelPosition("Zerg") # should output 1, position of vowel.
|
||||
|
||||
@@ -42,3 +42,9 @@ def\tskField\t$MODULE.TPerson.name\tbad_string\t
|
||||
|
||||
> idetools --track:$TESTNIM,43,7 --def $SILENT
|
||||
def\tskMethod\t$MODULE.eval\tproc \(PPlusExpr\): int\t
|
||||
|
||||
> idetools --track:$TESTNIM,47,8 --def $SILENT
|
||||
def\tskLabel\t$MODULE.findVowelPosition.loops\t\t
|
||||
# For some reason the use of the label with break displaces its position.
|
||||
> idetools --track:$TESTNIM,52,16 --def $SILENT
|
||||
def\tskLabel\t$MODULE.findVowelPosition.loops\t\t
|
||||
|
||||
Reference in New Issue
Block a user