test-namespace.R 616 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. test_that("namespace #1", {
  2. res <- llr_test("
  3. (ns wat)
  4. (def a 1)
  5. (ns wut)
  6. (def a 2)
  7. (ns wat)
  8. a
  9. ")
  10. expect_equal(res, 1, ignore_attr = TRUE)
  11. })
  12. test_that("namespace refer", {
  13. res <- llr_test("
  14. (ns wat)
  15. (def a 42)
  16. (ns wut)
  17. wat/a
  18. ")
  19. expect_equal(res, 42, ignore_attr = TRUE)
  20. })
  21. test_that("namespace llr.core is always imported", {
  22. res <- llr_test("
  23. (ns wat)
  24. (= 1 1)
  25. ")
  26. expect_true(res)
  27. })
  28. test_that("use works", {
  29. res <- llr_test("
  30. (ns wat)
  31. (def x 1)
  32. (ns wut)
  33. (use wat)
  34. x
  35. ")
  36. expect_equal(res, 1, ignore_attr = TRUE)
  37. })