tsince.nim 588 B

123456789101112131415161718192021222324252627282930313233
  1. import std/private/since
  2. import std/assertions
  3. proc fun1(): int {.since: (1, 3).} = 12
  4. proc fun1Bad(): int {.since: (99, 3).} = 12
  5. proc fun2(): int {.since: (1, 3, 1).} = 12
  6. proc fun2Bad(): int {.since: (99, 3, 1).} = 12
  7. doAssert fun1() == 12
  8. doAssert declared(fun1)
  9. doAssert not declared(fun1Bad)
  10. doAssert fun2() == 12
  11. doAssert declared(fun2)
  12. doAssert not declared(fun2Bad)
  13. var ok = false
  14. since (1, 3):
  15. ok = true
  16. doAssert ok
  17. ok = false
  18. since (1, 3, 1):
  19. ok = true
  20. doAssert ok
  21. since (99, 3):
  22. doAssert false
  23. template fun3(): int {.since: (1, 3).} = 12
  24. doAssert declared(fun3)