diff options
author | Araq <rumpf_a@web.de> | 2011-11-15 23:03:14 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-11-15 23:03:14 +0100 |
commit | 7819b84475ca6ba1cf3e9976c7140ea11775b81d (patch) | |
tree | 4c0fa123e17c88108f812754093a47977a888745 /tests | |
parent | 5f018a504674f5f46520dadb6d9e9a06f30752cc (diff) | |
download | Nim-7819b84475ca6ba1cf3e9976c7140ea11775b81d.tar.gz |
bugfixes: objects still invalid for constants; fixed a typo concerning 'high' in eval context
Diffstat (limited to 'tests')
-rw-r--r-- | tests/accept/run/tactiontable.nim | 2 | ||||
-rw-r--r-- | tests/reject/tactiontable2.nim | 28 |
2 files changed, 29 insertions, 1 deletions
diff --git a/tests/accept/run/tactiontable.nim b/tests/accept/run/tactiontable.nim index 6fe39359c..e2f19a099 100644 --- a/tests/accept/run/tactiontable.nim +++ b/tests/accept/run/tactiontable.nim @@ -16,7 +16,7 @@ proc action3(arg: string) = proc action4(arg: string) = echo "action 4 ", arg -const +var actionTable = { "A": action1, "B": action2, diff --git a/tests/reject/tactiontable2.nim b/tests/reject/tactiontable2.nim new file mode 100644 index 000000000..dbfa42f18 --- /dev/null +++ b/tests/reject/tactiontable2.nim @@ -0,0 +1,28 @@ +discard """ + line: 21 + errormsg: "invalid type: 'TTable'" +""" + +import tables + +proc action1(arg: string) = + echo "action 1 ", arg + +proc action2(arg: string) = + echo "action 2 ", arg + +proc action3(arg: string) = + echo "action 3 ", arg + +proc action4(arg: string) = + echo "action 4 ", arg + +const + actionTable = { + "A": action1, + "B": action2, + "C": action3, + "D": action4}.toTable + +actionTable["C"]("arg") + |