diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-07-30 14:02:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-30 14:02:03 +0200 |
commit | e55965a3d170f60776ffa2d82b2711d9ea3a0211 (patch) | |
tree | b73977b8e71445de9e5947d2db3bf941cc174f42 /tests/custom/04_modules/12_import_immutability | |
parent | 1219d7efa170bf38fb1bf6a10fa0d1f96e62f091 (diff) | |
parent | 156d584e4d0af46c39234ee68a98a16ab4cbe225 (diff) |
Merge pull request #96 from jow-/module-import-export-support
Module import export support
Diffstat (limited to 'tests/custom/04_modules/12_import_immutability')
-rw-r--r-- | tests/custom/04_modules/12_import_immutability | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/custom/04_modules/12_import_immutability b/tests/custom/04_modules/12_import_immutability new file mode 100644 index 0000000..37c0bc6 --- /dev/null +++ b/tests/custom/04_modules/12_import_immutability @@ -0,0 +1,52 @@ +Module imports are read-only bindings to the exported module variables. + +-- Testcase -- +import { a } from "./files/test.uc"; + +a = 2; +-- End -- + +-- File test.uc -- +export let a = 1; +-- End -- + +-- Args -- +-R +-- End -- + +-- Expect stderr -- +Syntax error: Invalid assignment to constant 'a' +In line 3, byte 5: + + `a = 2;` + ^-- Near here + + +-- End -- + + +Aggregated module objects are read-only as well. + +-- Testcase -- +import * as mod from "./files/test.uc"; + +mod.a = 2; +-- End -- + +-- File test.uc -- +export let a = 1; +-- End -- + +-- Args -- +-R +-- End -- + +-- Expect stderr -- +Type error: object value is immutable +In line 3, byte 9: + + `mod.a = 2;` + ^-- Near here + + +-- End -- |