summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/const-array-complex.mnml1
-rw-r--r--test/const-array.mnml2
-rw-r--r--test/const-function.mnml6
-rw-r--r--test/const-map.mnml11
-rw-r--r--test/const-simple.mnml2
-rw-r--r--test/const-union.mnml1
-rw-r--r--test/test.test78
7 files changed, 101 insertions, 0 deletions
diff --git a/test/const-array-complex.mnml b/test/const-array-complex.mnml
new file mode 100644
index 0000000..07e2286
--- /dev/null
+++ b/test/const-array-complex.mnml
@@ -0,0 +1 @@
+const array: [[integer]] = [[1, 2], [3, 4], [5, 6, 7]]
diff --git a/test/const-array.mnml b/test/const-array.mnml
new file mode 100644
index 0000000..03c7163
--- /dev/null
+++ b/test/const-array.mnml
@@ -0,0 +1,2 @@
+const array: [integer] = [1, 2, 3]
+const array2: [integer] = [3, 4, 5]
diff --git a/test/const-function.mnml b/test/const-function.mnml
new file mode 100644
index 0000000..1f77a73
--- /dev/null
+++ b/test/const-function.mnml
@@ -0,0 +1,6 @@
+const main: function = (input: string or integer): void {
+ const hello: string = input + " world!"
+ const bye: string = "bye!"
+
+ return hello + " " + bye
+}
diff --git a/test/const-map.mnml b/test/const-map.mnml
new file mode 100644
index 0000000..b63b68b
--- /dev/null
+++ b/test/const-map.mnml
@@ -0,0 +1,11 @@
+const map: [string][string or integer or bool] = [
+ "first" = 1 <= 2,
+ "second" = "two",
+ "third" = "3",
+ "fourth" = 4 > 3,
+/* "fifth" = (): void {
+ return "5."
+ },*/
+ "sixth" = 20_000,
+ "seventh" = 20.02,
+]
diff --git a/test/const-simple.mnml b/test/const-simple.mnml
new file mode 100644
index 0000000..5da0a0f
--- /dev/null
+++ b/test/const-simple.mnml
@@ -0,0 +1,2 @@
+const henshin: integer = 2
+const new: integer = henshin + 5 * 10
diff --git a/test/const-union.mnml b/test/const-union.mnml
new file mode 100644
index 0000000..ed9fe81
--- /dev/null
+++ b/test/const-union.mnml
@@ -0,0 +1 @@
+const henshin: integer or string or bool = "2"
diff --git a/test/test.test b/test/test.test
new file mode 100644
index 0000000..9fea5b2
--- /dev/null
+++ b/test/test.test
@@ -0,0 +1,78 @@
+const henshin: integer = 2 // comment
+// next comment
+var ply: string = "cool!"
+ply = "way cooler!!"
+
+const new: integer = henshin + 5 * 10
+
+const test: integer = 1 + 1
+
+const main: function = (input: string or integer): void {
+ const hello: string = input + " world!"
+ const bye: string = "bye!"
+
+ return hello + " " + bye
+}
+
+const x: string = main(input = "hello!")
+print(x)
+
+const array: [integer] = [1, 2, 3]
+const map: [string][string or integer] = [
+ "first" = 1,
+ "second" = "two",
+ "third" = "3",
+ "fourth" = 4,
+ "fifth" = (): void {
+ return "5."
+ },
+]
+
+main("pipe1!") => print($)
+main("pipe2!") => main($) => print($)
+
+const test_type: type = {
+ const test_field: string = "test"
+ var another_field: integer = 4
+
+ const test_function: function = (): void {
+ return self.test_field
+ }
+
+ const another_function: function = (add: integer): integer {
+ return self.another_field + add
+ }
+}
+
+const other_int: type = integer
+
+const inherited_type: type[test_type] = {
+ const nested: test_type = test_type()
+
+ const new_function: function = (): void {
+ return self.another_field + 4
+ }
+}
+
+const object: inherited_type = inherited_type()
+object.test_field = "hey"
+object.test_function() => print($)
+object.nested.another_field = 5
+object.nested.another_function(add = 2) => print($)
+
+if (henshin == 2) {
+ print("nice")
+}
+print(henshin == 3 or henshin > 1)
+henshin = 4
+if (henshin == 3) {
+ print("shouldn't be")
+} else if (henshin == 2 or henshin != 3) {
+ print("else will")
+} else if (henshin != 3 and henshin != 2) {
+ print("else won't")
+}
+
+const scoped: [string][string or function] = import("test_import.test")
+print(scoped)
+scoped.exported_function() => print($)