From d4ad3c8dddd06c79cf48198edf46d7c928d2fa1a Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 18 Oct 2023 22:27:57 -0400 Subject: [PATCH] Update tests; Set bin name; Increment version --- Cargo.lock | 2 +- Cargo.toml | 6 +++++- examples/clue_solver.ds | 2 +- examples/scope.ds | 10 ++++----- examples/table.ds | 45 ++++++++++++++++++----------------------- examples/variables.ds | 4 ++-- tests/dust_examples.rs | 4 ++-- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ab0c14..051c688 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -915,7 +915,7 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "dust-lang" -version = "0.3.0" +version = "0.3.1" dependencies = [ "ansi_term", "cc", diff --git a/Cargo.toml b/Cargo.toml index 10b2af7..9295b5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,15 @@ [package] name = "dust-lang" description = "Data-Oriented Programming Language" -version = "0.3.0" +version = "0.3.1" repository = "https://github.com/tree-sitter/tree-sitter-dust" edition = "2018" license = "MIT" +[[bin]] +name = "dust" +path = "src/main.rs" + [dependencies] ansi_term = "0.12.1" chrono = "0.4.31" diff --git a/examples/clue_solver.ds b/examples/clue_solver.ds index b81e57e..c0b3c20 100644 --- a/examples/clue_solver.ds +++ b/examples/clue_solver.ds @@ -10,7 +10,7 @@ take_turn = function { remove_card = function { for card_list in cards { - removed_card = remove card from cards { + remove card from cards { card == opponent_card } } diff --git a/examples/scope.ds b/examples/scope.ds index 0bf0a5b..d4b6b2a 100644 --- a/examples/scope.ds +++ b/examples/scope.ds @@ -1,9 +1,9 @@ -foo = "bar"; -func = 'foo'; +foo = "bar" +func = function <> { "foo" } -assert_equal("bar", func()); +assert_equal("bar", (func)) -foo = "xyz"; +foo = "xyz" -assert_equal("xyz", func()); +assert_equal("xyz", (func)) diff --git a/examples/table.ds b/examples/table.ds index 65b75cc..f457d9b 100644 --- a/examples/table.ds +++ b/examples/table.ds @@ -1,29 +1,24 @@ -table = create_table( - ("text", "number", "bool"), - ( - ("a", 1, true), - ("b", 2, true), - ("a", 3, true) - ) -); +table = create_table [ + ["a", 1, true] + ["b", 2, true] + ["a", 3, true] +] -test_table = create_table( - ("text", "bool"), - ( - ("a", true), - ("b", true), - ("a", true) - ) -); +test_table = create_table [ + ["a", true] + ["b", true] + ["a", true] +] -assert_equal(select(table, ("text", "bool")), test_table); +select = select from table -test_table = create_table( - ("text", "number", "bool"), - ( - ("a", 1, true), - ("a", 3, true) - ) -); +(assert_equal select, test_table) -assert_equal(where(table, 'text == "a"'), test_table); +test_table = create_table [ + ["a", 1, true] + ["a", 3, true] +] + +select_where = select * from table where text == "a" + +assert_equal(select_where, test_table); diff --git a/examples/variables.ds b/examples/variables.ds index 94be0d8..7c00a11 100644 --- a/examples/variables.ds +++ b/examples/variables.ds @@ -1,8 +1,8 @@ x = 1 y = "hello dust!" z = 42.0 -list = (3, 2, x) -big_list = (x, y, z, list) +list = [3, 2, x] +big_list = [x, y, z, list] foo = { x = "bar" y = 42 diff --git a/tests/dust_examples.rs b/tests/dust_examples.rs index 07ce78a..88d888e 100644 --- a/tests/dust_examples.rs +++ b/tests/dust_examples.rs @@ -45,8 +45,8 @@ fn find_loop() { } #[test] -fn fizz_buzz() { - let file_contents = read_to_string("examples/fizz_buzz.ds").unwrap(); +fn fizzbuzz() { + let file_contents = read_to_string("examples/fizzbuzz.ds").unwrap(); evaluate(&file_contents).unwrap(); }