aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJoey Yakimowich-Payne <jyapayne@gmail.com>2020-04-19 19:18:04 -0600
committerJoey Yakimowich-Payne <jyapayne@gmail.com>2020-04-26 09:11:33 -0600
commit173e6d625c3ea96a95580303fedd011684635cc4 (patch)
tree287fb1777e67255e7e49d130205b3538f4d19696 /tests
parent62c68d69ee0409558a846aae3a85cf1a29f9442b (diff)
downloadnimterop-173e6d625c3ea96a95580303fedd011684635cc4.tar.gz
nimterop-173e6d625c3ea96a95580303fedd011684635cc4.zip
Add string and char support
Update some comments Rename exprparser main proc Don't export parse procs Add missing utils module Try to fix array type test Try fix cast test error Disable cast test for now Revert back comment test. Have to figure out how to test without vm
Diffstat (limited to 'tests')
-rw-r--r--tests/include/tast2.h6
-rw-r--r--tests/tast2.nim12
2 files changed, 15 insertions, 3 deletions
diff --git a/tests/include/tast2.h b/tests/include/tast2.h
index 7e15ac0..3c6148a 100644
--- a/tests/include/tast2.h
+++ b/tests/include/tast2.h
@@ -23,6 +23,12 @@ extern "C" {
#define BOOL true
#define MATHEXPR (1 + 2/3*20 - 100)
#define ANDEXPR (100 & 11000)
+#define CASTEXPR (int) 34
+
+#define NULLCHAR '\0'
+#define OCTCHAR '\012'
+#define HEXCHAR '\xFE'
+#define TRICKYSTR "\x4E\034\nfoo\0\'\"\r\v\a\b\e\f\t\\\?bar"
#define ALLSHL (SHL1 | SHL2 | SHL3)
diff --git a/tests/tast2.nim b/tests/tast2.nim
index d65e34a..d00552c 100644
--- a/tests/tast2.nim
+++ b/tests/tast2.nim
@@ -93,11 +93,11 @@ macro testFields(t: typed, fields: static[string] = "") =
for i in 0 ..< rl.len:
let
name = ($rl[i][0]).strip(chars = {'*'})
- typ = ($(rl[i][1].repr())).replace("\n", "").replace(" ", "")
+ typ = ($(rl[i][1].repr())).replace("\n", "").replace(" ", "").replace("typeof", "type")
n = names.find(name)
assert n != -1, $t & "." & name & " invalid"
- assert types[n] == typ,
- "typeof(" & $t & ":" & name & ") != " & types[n] & ", is " & typ
+ assert types[n].replace("typeof", "type") == typ,
+ "typeof(" & $t & ":" & name & ") != " & types[n].replace("typeof", "type") & ", is " & typ
assert A == 2
assert B == 1.0
@@ -118,6 +118,12 @@ assert BINEXPR == 5
assert BOOL == true
assert MATHEXPR == -99
assert ANDEXPR == 96
+assert CASTEXPR == 34.chr
+
+assert TRICKYSTR == "N\x1C\nfoo\x00\'\"\c\v\a\b\e\f\t\\\\?bar"
+assert NULLCHAR == '\0'
+assert OCTCHAR == '\n'
+assert HEXCHAR.int == 0xFE
assert SHL1 == (1.uint shl 1)
assert SHL2 == (1.uint shl 2)