mirror of
https://github.com/zaphar/ucg.git
synced 2025-07-22 18:19:54 -04:00
closes #10 Squashed commit of the following: commit 3101c2bb9a385ed9e84481d36906a3e3ce93e571 Author: Jeremy Wall <jeremy@marzhillstudios.com> Date: Wed Nov 21 20:10:31 2018 -0600 FEATURE: Module evaluation * handle evaluating the module definition. * Handle performing a module instantiation via the copy syntax. commit 4ca863896b416e39f0c8eacc53384b9c514f6f14 Author: Jeremy Wall <jeremy@marzhillstudios.com> Date: Tue Nov 20 18:38:19 2018 -0600 FEATURE: Add module parsing expression parsing to ucg. changes toward issue #10
45 lines
877 B
Plaintext
45 lines
877 B
Plaintext
let test_empty_mod = module {
|
|
} => {
|
|
};
|
|
|
|
let empty_mod_instance = test_empty_mod{};
|
|
|
|
let test_simple_mod = module {
|
|
arg = "value",
|
|
} => {
|
|
let value = mod.arg;
|
|
};
|
|
|
|
let simple_mod_instance = test_simple_mod{};
|
|
assert |
|
|
simple_mod_instance.value == "value";
|
|
|;
|
|
|
|
let simple_mod_with_args = test_simple_mod{arg = "othervalue"};
|
|
assert |
|
|
simple_mod_with_args.value == "othervalue";
|
|
|;
|
|
|
|
let embedded_mod = module {
|
|
deep_value = "None",
|
|
} => {
|
|
let embedded_def = module {
|
|
deep_value = "None",
|
|
} => {
|
|
let value = mod.deep_value;
|
|
};
|
|
|
|
let embedded = embedded_def{deep_value = mod.deep_value};
|
|
};
|
|
|
|
let embedded_default_params = embedded_mod{};
|
|
|
|
assert |
|
|
embedded_default_params.embedded.value == "None";
|
|
|;
|
|
|
|
let embedded_with_params = embedded_mod{deep_value = "Some"};
|
|
|
|
assert |
|
|
embedded_with_params.embedded.value == "Some";
|
|
|; |