aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-16 22:00:07 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-16 22:00:07 +0300
commit63003d252721af56d311163afe937df771f15843 (patch)
tree1195256369f0d52db72e15ef4d431d1ad2a511bf /tests
parent36e783aababadc0bb3e3c55f7616650523877e96 (diff)
downloadek-63003d252721af56d311163afe937df771f15843.tar.gz
ek-63003d252721af56d311163afe937df771f15843.zip
array syntax
Diffstat (limited to 'tests')
-rw-r--r--tests/arr.ek2
-rw-r--r--tests/structs.ek30
2 files changed, 6 insertions, 26 deletions
diff --git a/tests/arr.ek b/tests/arr.ek
index d4f35f7..8596fd0 100644
--- a/tests/arr.ek
+++ b/tests/arr.ek
@@ -1,5 +1,5 @@
main()
{
- a '[20]'[20]'type![u32, u32];
+ a '[20]'[20]'type![u32, u32] = [20, => 20 ... 200 = 240, [200, 200]];
a[20] = 200;
}
diff --git a/tests/structs.ek b/tests/structs.ek
index ed0b30f..20d9c48 100644
--- a/tests/structs.ek
+++ b/tests/structs.ek
@@ -15,34 +15,14 @@ struct complex_struct (A any, B any, C any) {
main()
{
/* infer types */
- simple_named const = !{.a = 1, .b = 2, .c = 3} as basic_struct;
- simple_ordinal const = !{1, 2, 3} as basic_struct;
- simple_mixed const = !{1, .b = 2, 3} as basic_struct;
-
- complex_named const = !{.a = 1, .b = 2, .c = 3} as complex_struct;
- /* should parentheses be required around typeof? */
- complex_ordinal const = !{1, 2, 3} as typeof complex_named;
- complex_mixed const = !{1, .b = 2, 3} as complex_struct;
+ simple_named const = {.a = 1, .b = 2, .c = 3} as basic_struct;
+ complex_named const = {.a = 1, .b = 2, .c = 3} as complex_struct;
/* force types */
- force_named complex_struct![u32, u32, u32] = !{.a = 1, .b = 2, .c = 3};
- force_ordinal typeof force_named = !{1, 2, 3};
- force_mixed typeof force_ordinal = !{1, .b = 2, 3};
-
- force_inferred_named mut = !{.a = 1, .b = 2, .c = 3} as
- complex_struct![u32, u32, u32];
-
- force_inferred_ordinal mut = !{1, 2, 3} as
+ force_named complex_struct![u32, u32, u32] = {.a = 1, .b = 2, .c = 3};
+ force_inferred_named mut = {.a = 1, .b = 2, .c = 3} as
complex_struct![u32, u32, u32];
- force_inferred_mixed mut = !{1, .b = 2, 3} as
- complex_struct![u32, u32, u32];
-
- /* shouldn't be compileable due to not enough type info */
- // error_named const = !{.a = 1, .b = 2, .c = 3};
-
/* types should be inferred */
- force_inferred_named = !{.a = 2, .b = 3, .c = 4};
- force_inferred_ordinal = !{2, 3, 4};
- force_inferred_mixed = !{2, .b = 3, 4};
+ force_inferred_named = {.a = 2, .b = 3, .c = 4};
}