summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/hello-world.hnshn28
-rw-r--r--test/test.test91
2 files changed, 43 insertions, 76 deletions
diff --git a/test/hello-world.hnshn b/test/hello-world.hnshn
deleted file mode 100644
index 4d4af3d..0000000
--- a/test/hello-world.hnshn
+++ /dev/null
@@ -1,28 +0,0 @@
-const std = import('@std');
-
-function main(): void {
- const integer: integer32 = 123;
- const string: string = '123';
- const array: [integer32][3] = [1, 2, 3];
- const map: [string][string|integer32] = [
- 'first': 1,
- 'second': 'two',
- 'third': 3,
- ];
-
- for (array) |index, value| {
- // cool
- }
-
- for (map) |key, value| {
- // also cool
- }
-
- for (string) |index, char| {
- // cool?
- const char2 = std.str.get_char_at_index(string, index);
- }
-
- std.str.format('cool %s', string)
- |> print($);
-}
diff --git a/test/test.test b/test/test.test
index 3778099..149f1a6 100644
--- a/test/test.test
+++ b/test/test.test
@@ -1,65 +1,60 @@
-const henshin: integer = 2; // comment
+const henshin: integer = 2 // comment
// next comment
-var ply: string = "cool!";
-ply = "way cooler!!";
+var ply: string = "cool!"
+ply = "way cooler!!"
-const new: integer = henshin * 5 + 10;
+const new: integer = henshin + 5 * 10
-const test: integer = 1 + 1;
+const test: integer = 1 + 1
-function main(input: string or integer): void {
- const hello: string = "world!";
- const bye: string = "bye!";
+const main: function = (input: string or integer): void {
+ const hello: string = input + " world!"
+ const bye: string = "bye!"
- return hello;
+ return hello + " " + bye
}
-main(input = "hello!");
+const x: string = main(input = "hello!")
+print(x)
-const array: [integer] = [1, 2, 3];
+const array: [integer] = [1, 2, 3]
const map: [string][string or integer] = [
"first" = 1,
"second" = "two",
"third" = "3",
- "fourth" = 4
-];
-
-for (array) |index, value| {
- ply = value;
-}
-
-for (map) |key, value| {
- ply = key;
+ "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
+ }
}
-main() => print($);
-main() => main2($) => print($);
-
-//type test_type = {
-// const test_field: string = "test",
-// var another_field: integer = 4,
-//
-// function test_function(): void {
-// return test_type.test_field;
-// },
-// function_field: function = another_function(): void {
-// return test_type.another_field;
-// },
-//};
+const other_int: type = integer
-// type other_int = integer;
+const inherited_type: type[test_type] = {
+ const nested: test_type = test_type()
-//const test_type: type = {};
-//const other_int: type = integer;
-
-//const main: function = function(input: string): void {
-// return input;
-//};
-
-//const main: function = (input: string): void {
-// return input;
-//};
+ const new_function: function = (): void {
+ return self.another_field + 4
+ }
+}
-//iterate(array, (index: integer, value: integer) {
-//
-//});
+const object: inherited_type = inherited_type()
+//object.test_field = "hey"
+//object.test_function() => print($)
+//object.nested.another_function(add = 2)