1
0

Pass tests

This commit is contained in:
Jeff 2023-11-16 02:11:47 -05:00
parent ff836b4f0a
commit c4dd68c293
10 changed files with 17 additions and 60 deletions

View File

@ -1,3 +0,0 @@
filter item in (from_json (read 'examples/assets/jq_data.json')) {
(length item.commit.committer.name) <= 10
}

View File

@ -1,7 +0,0 @@
list = [1 2 1 3]
found = find i in list {
i == 3
}
(assert_equal 3 found)

View File

@ -1,8 +1,12 @@
data = (from_json (read 'examples/assets/jq_data.json'))
transform commit_data in data {
{
new_data = [];
for commit_data in data {
new_data += (
message = commit_data.commit.message
name = commit_data.commit.committer.name
}
)
}
new_data

View File

@ -1,7 +1,7 @@
dictionary = {
dictionary = (
dust = "awesome"
answer = 42
}
)
(output
'Dust is '

View File

@ -1,8 +0,0 @@
list = [1 2 1 3]
removed = remove i from list {
i == 3
}
(assert_equal 3 removed)
(assert_equal [1 2 1] list)

View File

@ -1,5 +0,0 @@
data = (from_json (read "examples/assets/jq_data.json"))
transform item in data {
item:commit:committer:name
}

View File

@ -1,9 +1,13 @@
1 -> (output)
add_one = |list| => {
transform number in list {
number + 1
new_list = []
for number in list {
new_list += number + 1
}
new_list
}
foo = [1, 2, 3] -> (add_one)

View File

@ -89,7 +89,7 @@ mod tests {
#[test]
fn evaluate_map_index() {
let test = evaluate("x = {y = {z = 2}} x:y:z").unwrap();
let test = evaluate("x = (y = (z = 2)) x:y:z").unwrap();
assert_eq!(Value::Integer(2), test);
}

View File

@ -164,7 +164,7 @@ mod tests {
variables.insert("foo".to_string(), Value::String("bar".to_string()));
}
assert_eq!(evaluate("{ x = 1, foo = 'bar' }"), Ok(Value::Map(map)));
assert_eq!(evaluate("( x = 1, foo = 'bar' )"), Ok(Value::Map(map)));
}
#[test]

View File

@ -39,20 +39,6 @@ fn fibonacci() {
evaluate(&file_contents).unwrap();
}
#[test]
fn filter_loop() {
let file_contents = read_to_string("examples/filter_loop.ds").unwrap();
evaluate(&file_contents).unwrap();
}
#[test]
fn find_loop() {
let file_contents = read_to_string("examples/find_loop.ds").unwrap();
evaluate(&file_contents).unwrap();
}
#[test]
fn fizzbuzz() {
let file_contents = read_to_string("examples/fizzbuzz.ds").unwrap();
@ -102,13 +88,6 @@ fn random() {
evaluate(&file_contents).unwrap();
}
#[test]
fn remove_loop() {
let file_contents = read_to_string("examples/remove_loop.ds").unwrap();
evaluate(&file_contents).unwrap();
}
#[test]
fn sea_creatures() {
let file_contents = read_to_string("examples/sea_creatures.ds").unwrap();
@ -130,13 +109,6 @@ fn table() {
evaluate(&file_contents).unwrap();
}
#[test]
fn transform_loop() {
let file_contents = read_to_string("examples/transform_loop.ds").unwrap();
evaluate(&file_contents).unwrap();
}
#[test]
fn variables() {
let file_contents = read_to_string("examples/variables.ds").unwrap();