diff options
Diffstat (limited to 'tests/custom/04_modules/14_circular_imports')
-rw-r--r-- | tests/custom/04_modules/14_circular_imports | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/custom/04_modules/14_circular_imports b/tests/custom/04_modules/14_circular_imports new file mode 100644 index 0000000..0b6070a --- /dev/null +++ b/tests/custom/04_modules/14_circular_imports @@ -0,0 +1,43 @@ +Circular imports are not possible and will lead to a compilation error. + +-- Testcase -- +import a_val from "./files/a.uc"; +-- End -- + +-- File a.uc -- +import b_val from "./b.uc"; +export default "a"; +-- End -- + +-- File b.uc -- +import a_val from "./a.uc"; +export default "b"; +-- End -- + +-- Args -- +-R +-- End -- + +-- Expect stderr -- +Syntax error: Unable to compile module './files/a.uc': + + | Syntax error: Unable to compile module './files/b.uc': + | + | | Syntax error: Circular dependency + | | In ./files/b.uc, line 1, byte 19: + | | + | | `import a_val from "./a.uc";` + | | Near here --------^ + | + | In ./files/a.uc, line 1, byte 27: + | + | `import b_val from "./b.uc";` + | Near here ----------------^ + +In [stdin], line 1, byte 33: + + `import a_val from "./files/a.uc";` + Near here ----------------------^ + + +-- End -- |