diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/closure/tnamedparamanonproc.nim | 4 | ||||
-rw-r--r-- | tests/controlflow/tblock1.nim (renamed from tests/block/tblock1.nim) | 0 | ||||
-rw-r--r-- | tests/controlflow/tnestif.nim (renamed from tests/ifstmt/tnestif.nim) | 0 | ||||
-rw-r--r-- | tests/iter/tanoniter1.nim | 32 | ||||
-rw-r--r-- | tests/iter/titer2.nim | 2 | ||||
-rw-r--r-- | tests/metatype/tstaticparams.nim (renamed from tests/static/tstaticparams.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr.nim (renamed from tests/object/tobjconstr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjconstr2.nim (renamed from tests/object/tobjconstr2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobjcov.nim (renamed from tests/object/tobjcov.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject.nim (renamed from tests/object/tobject.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject2.nim (renamed from tests/object/tobject2.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tobject3.nim (renamed from tests/object/tobject3.nim) | 0 | ||||
-rw-r--r-- | tests/objects/tofopr.nim (renamed from tests/operator/tofopr.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop.nim (renamed from tests/object/toop.nim) | 0 | ||||
-rw-r--r-- | tests/objects/toop1.nim (renamed from tests/object/toop1.nim) | 0 | ||||
-rw-r--r-- | tests/parser/toprprec.nim (renamed from tests/operator/toprprec.nim) | 0 | ||||
-rw-r--r-- | tests/parser/tprecedence.nim (renamed from tests/operator/tprecedence.nim) | 0 | ||||
-rw-r--r-- | tests/showoff/tdrdobbs_examples.nim (renamed from tests/important/tdrdobbs_examples.nim) | 0 |
18 files changed, 35 insertions, 3 deletions
diff --git a/tests/closure/tnamedparamanonproc.nim b/tests/closure/tnamedparamanonproc.nim index 272b84e91..94e32894f 100644 --- a/tests/closure/tnamedparamanonproc.nim +++ b/tests/closure/tnamedparamanonproc.nim @@ -4,8 +4,8 @@ type TButtonClicked = proc(button: PButton) {.nimcall.} proc newButton*(onClick: TButtonClicked) = - nil - + discard + proc main() = newButton(onClick = proc(b: PButton) = var requestomat = 12 diff --git a/tests/block/tblock1.nim b/tests/controlflow/tblock1.nim index 5c41aaf82..5c41aaf82 100644 --- a/tests/block/tblock1.nim +++ b/tests/controlflow/tblock1.nim diff --git a/tests/ifstmt/tnestif.nim b/tests/controlflow/tnestif.nim index bfcd8751c..bfcd8751c 100644 --- a/tests/ifstmt/tnestif.nim +++ b/tests/controlflow/tnestif.nim diff --git a/tests/iter/tanoniter1.nim b/tests/iter/tanoniter1.nim new file mode 100644 index 000000000..9db5ab8ec --- /dev/null +++ b/tests/iter/tanoniter1.nim @@ -0,0 +1,32 @@ +discard """ + output: '''1 +2 +3 +4 +1 +2''' +""" + +proc factory(a, b: int): iterator (): int = + iterator foo(): int = + var x = a + while x <= b: + yield x + inc x + return foo + +proc factory2(a, b: int): iterator (): int = + return iterator (): int = + var x = a + while x <= b: + yield x + inc x + +let foo = factory 1, 4 + +for f in foo(): + echo f + +let foo2 = factory2 1,2 + +for f in foo2(): echo f diff --git a/tests/iter/titer2.nim b/tests/iter/titer2.nim index dab2713e8..f8967109e 100644 --- a/tests/iter/titer2.nim +++ b/tests/iter/titer2.nim @@ -1,6 +1,6 @@ discard """ output: '''true''' - cmd: "nimrod cc --gc:none --hints:on $# $#" + cmd: "nimrod cc --gc:none --hints:on --warnings:off $# $#" """ import hashes diff --git a/tests/static/tstaticparams.nim b/tests/metatype/tstaticparams.nim index b1377443b..b1377443b 100644 --- a/tests/static/tstaticparams.nim +++ b/tests/metatype/tstaticparams.nim diff --git a/tests/object/tobjconstr.nim b/tests/objects/tobjconstr.nim index 3bd785728..3bd785728 100644 --- a/tests/object/tobjconstr.nim +++ b/tests/objects/tobjconstr.nim diff --git a/tests/object/tobjconstr2.nim b/tests/objects/tobjconstr2.nim index cb47e146d..cb47e146d 100644 --- a/tests/object/tobjconstr2.nim +++ b/tests/objects/tobjconstr2.nim diff --git a/tests/object/tobjcov.nim b/tests/objects/tobjcov.nim index fc44edf8e..fc44edf8e 100644 --- a/tests/object/tobjcov.nim +++ b/tests/objects/tobjcov.nim diff --git a/tests/object/tobject.nim b/tests/objects/tobject.nim index 5fec84441..5fec84441 100644 --- a/tests/object/tobject.nim +++ b/tests/objects/tobject.nim diff --git a/tests/object/tobject2.nim b/tests/objects/tobject2.nim index 0f1869695..0f1869695 100644 --- a/tests/object/tobject2.nim +++ b/tests/objects/tobject2.nim diff --git a/tests/object/tobject3.nim b/tests/objects/tobject3.nim index 935e6ca8c..935e6ca8c 100644 --- a/tests/object/tobject3.nim +++ b/tests/objects/tobject3.nim diff --git a/tests/operator/tofopr.nim b/tests/objects/tofopr.nim index 961d81bd3..961d81bd3 100644 --- a/tests/operator/tofopr.nim +++ b/tests/objects/tofopr.nim diff --git a/tests/object/toop.nim b/tests/objects/toop.nim index 0b42c2c22..0b42c2c22 100644 --- a/tests/object/toop.nim +++ b/tests/objects/toop.nim diff --git a/tests/object/toop1.nim b/tests/objects/toop1.nim index 350799f51..350799f51 100644 --- a/tests/object/toop1.nim +++ b/tests/objects/toop1.nim diff --git a/tests/operator/toprprec.nim b/tests/parser/toprprec.nim index ce33934b5..ce33934b5 100644 --- a/tests/operator/toprprec.nim +++ b/tests/parser/toprprec.nim diff --git a/tests/operator/tprecedence.nim b/tests/parser/tprecedence.nim index 6b1b250a2..6b1b250a2 100644 --- a/tests/operator/tprecedence.nim +++ b/tests/parser/tprecedence.nim diff --git a/tests/important/tdrdobbs_examples.nim b/tests/showoff/tdrdobbs_examples.nim index d1e0585d2..d1e0585d2 100644 --- a/tests/important/tdrdobbs_examples.nim +++ b/tests/showoff/tdrdobbs_examples.nim |