timports.nim 576 B

123456789101112131415161718192021222324252627282930
  1. import mimports
  2. doAssert fn1() == 1
  3. doAssert not declared(hfn3)
  4. #!EDIT!#
  5. import mimports {.all.}
  6. doAssert fn1() == 1
  7. doAssert declared(hfn3)
  8. doAssert hfn3() == 3
  9. doAssert mimports.hfn4() == 4
  10. # reexports
  11. doAssert not declared(fnb1)
  12. doAssert not declared(hfnb4)
  13. doAssert fnb2() == 2
  14. doAssert hfnb3() == 3
  15. #!EDIT!#
  16. from mimports {.all.} import hfn3
  17. doAssert not declared(fn1)
  18. from mimports {.all.} as bar import fn1
  19. doAssert fn1() == 1
  20. doAssert hfn3() == 3
  21. doAssert not declared(hfn4)
  22. doAssert declared(mimports.hfn4)
  23. doAssert mimports.hfn4() == 4
  24. doAssert bar.hfn4() == 4