diff options
author | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-06 19:42:36 +0200 |
---|---|---|
committer | Grzegorz Adam Hankiewicz <gradha@imap.cc> | 2013-07-06 19:42:36 +0200 |
commit | 383d047763a4ef336fca7e299dd36d0c71a29d58 (patch) | |
tree | edec37cd7e597a5b64695510a4e2f5f265d61f7a | |
parent | 4ed44fc6348cc09a8c809a76b6f21a456fa0d0c7 (diff) | |
download | Nim-383d047763a4ef336fca7e299dd36d0c71a29d58.tar.gz |
Documents idetools skLabel with failure test case.
-rw-r--r-- | doc/idetools.txt | 16 | ||||
-rw-r--r-- | tests/caas/idetools_api.nim | 12 | ||||
-rw-r--r-- | tests/caas/idetools_api.txt | 6 |
3 files changed, 34 insertions, 0 deletions
diff --git a/doc/idetools.txt b/doc/idetools.txt index 59e2ee49e..4d2315a0c 100644 --- a/doc/idetools.txt +++ b/doc/idetools.txt @@ -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 ----- diff --git a/tests/caas/idetools_api.nim b/tests/caas/idetools_api.nim index 6327f4c22..351ec0583 100644 --- a/tests/caas/idetools_api.nim +++ b/tests/caas/idetools_api.nim @@ -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. diff --git a/tests/caas/idetools_api.txt b/tests/caas/idetools_api.txt index c4c22399e..f4a2ee69e 100644 --- a/tests/caas/idetools_api.txt +++ b/tests/caas/idetools_api.txt @@ -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 |