aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2023-08-15 21:41:29 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2023-08-15 21:41:29 +0300
commitbad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b (patch)
treed43dd3a26685c9adc8201dfe1a4035418175c1eb /tests
parent5ffc39352ef0195697953e9318b8a17c79e7ae84 (diff)
downloadek-bad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b.tar.gz
ek-bad9ab7479d66dfdb1c8e2d18c23fbcff9ec394b.zip
updates to syntax
Diffstat (limited to 'tests')
-rw-r--r--tests/arr.ek5
-rw-r--r--tests/blocks.ek10
-rw-r--r--tests/callbacks.ek4
-rw-r--r--tests/resolve.ek2
-rw-r--r--tests/structs.ek38
5 files changed, 37 insertions, 22 deletions
diff --git a/tests/arr.ek b/tests/arr.ek
new file mode 100644
index 0000000..d4f35f7
--- /dev/null
+++ b/tests/arr.ek
@@ -0,0 +1,5 @@
+main()
+{
+ a '[20]'[20]'type![u32, u32];
+ a[20] = 200;
+}
diff --git a/tests/blocks.ek b/tests/blocks.ek
new file mode 100644
index 0000000..e91d33c
--- /dev/null
+++ b/tests/blocks.ek
@@ -0,0 +1,10 @@
+main()
+{
+ a mut = switch 1 {
+ case 2: 2
+ case 1: 1
+ default: 20; 20
+ };
+
+ c mut = ({2 + 2; 4 + 4});
+}
diff --git a/tests/callbacks.ek b/tests/callbacks.ek
index 0249065..9b9d649 100644
--- a/tests/callbacks.ek
+++ b/tests/callbacks.ek
@@ -1,4 +1,4 @@
-do_stuff(proc '(u32))
+do_stuff(proc @(u32))
{
proc();
}
@@ -13,5 +13,5 @@ other_proc()
main()
{
- do_stuff(other_proc as '(u32));
+ do_stuff(other_proc as @(u32));
}
diff --git a/tests/resolve.ek b/tests/resolve.ek
index 1be0916..5ac7d71 100644
--- a/tests/resolve.ek
+++ b/tests/resolve.ek
@@ -30,6 +30,6 @@ some_func(generic){5;}
main(){
// TODO: not fully qualified types in bodies should cause an error
- a generic(i64, generic);
+ a [20]generic![i64, generic];
some_func(a);
}
diff --git a/tests/structs.ek b/tests/structs.ek
index 8a3a1bb..ed0b30f 100644
--- a/tests/structs.ek
+++ b/tests/structs.ek
@@ -15,34 +15,34 @@ 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;
+ 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;
+ 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;
+ complex_ordinal const = !{1, 2, 3} as typeof complex_named;
+ complex_mixed const = !{1, .b = 2, 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_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_named mut = !{.a = 1, .b = 2, .c = 3} as
+ complex_struct![u32, u32, u32];
- force_inferred_ordinal mut = {1, 2, 3} as
- complex_struct(u32, u32, u32);
+ force_inferred_ordinal mut = !{1, 2, 3} as
+ complex_struct![u32, u32, u32];
- force_inferred_mixed mut = {1, .b = 2, 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};
+ // 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};
+ force_inferred_ordinal = !{2, 3, 4};
+ force_inferred_mixed = !{2, .b = 3, 4};
}