summary refs log tree commit diff stats
path: root/tests/stdlib
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-04-26 05:55:25 -0700
committerGitHub <noreply@github.com>2020-04-26 14:55:25 +0200
commit9384f7ad35aa36a22b31d7541254e89890d6cec2 (patch)
tree38e8a9bd5485df43e7870444b9e8fee902316634 /tests/stdlib
parentd23446c6baea34438be44e7dad5a467c0a17cb27 (diff)
downloadNim-9384f7ad35aa36a22b31d7541254e89890d6cec2.tar.gz
since now takes an optional patch, eg: `since: (1, 3, 1)` (#14124)
add tests for tinclrtl
Diffstat (limited to 'tests/stdlib')
-rw-r--r--tests/stdlib/tinclrtl.nim32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/stdlib/tinclrtl.nim b/tests/stdlib/tinclrtl.nim
new file mode 100644
index 000000000..2d4c34a90
--- /dev/null
+++ b/tests/stdlib/tinclrtl.nim
@@ -0,0 +1,32 @@
+include system/inclrtl
+
+proc fun1(): int {.since: (1,3).} = 12
+proc fun1Bad(): int {.since: (99,3).} = 12
+proc fun2(): int {.since: (1,3,1).} = 12
+proc fun2Bad(): int {.since: (99,3,1).} = 12
+
+doAssert fun1() == 12
+doAssert declared(fun1)
+doAssert not declared(fun1Bad)
+
+doAssert fun2() == 12
+doAssert declared(fun2)
+doAssert not declared(fun2Bad)
+
+var ok = false
+since (1, 3):
+  ok = true
+doAssert ok
+
+ok = false
+since (1, 3, 1):
+  ok = true
+doAssert ok
+
+since (99,3):
+  doAssert false
+
+when false:
+  # pending https://github.com/timotheecour/Nim/issues/129
+  # Error: cannot attach a custom pragma to 'fun3'
+  template fun3(): int {.since: (1, 3).} = 12