Pass tests
This commit is contained in:
parent
ff836b4f0a
commit
c4dd68c293
@ -1,3 +0,0 @@
|
|||||||
filter item in (from_json (read 'examples/assets/jq_data.json')) {
|
|
||||||
(length item.commit.committer.name) <= 10
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
list = [1 2 1 3]
|
|
||||||
|
|
||||||
found = find i in list {
|
|
||||||
i == 3
|
|
||||||
}
|
|
||||||
|
|
||||||
(assert_equal 3 found)
|
|
@ -1,8 +1,12 @@
|
|||||||
data = (from_json (read 'examples/assets/jq_data.json'))
|
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
|
message = commit_data.commit.message
|
||||||
name = commit_data.commit.committer.name
|
name = commit_data.commit.committer.name
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_data
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
dictionary = {
|
dictionary = (
|
||||||
dust = "awesome"
|
dust = "awesome"
|
||||||
answer = 42
|
answer = 42
|
||||||
}
|
)
|
||||||
|
|
||||||
(output
|
(output
|
||||||
'Dust is '
|
'Dust is '
|
||||||
|
@ -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)
|
|
@ -1,5 +0,0 @@
|
|||||||
data = (from_json (read "examples/assets/jq_data.json"))
|
|
||||||
|
|
||||||
transform item in data {
|
|
||||||
item:commit:committer:name
|
|
||||||
}
|
|
@ -1,9 +1,13 @@
|
|||||||
1 -> (output)
|
1 -> (output)
|
||||||
|
|
||||||
add_one = |list| => {
|
add_one = |list| => {
|
||||||
transform number in list {
|
new_list = []
|
||||||
number + 1
|
|
||||||
|
for number in list {
|
||||||
|
new_list += number + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
new_list
|
||||||
}
|
}
|
||||||
|
|
||||||
foo = [1, 2, 3] -> (add_one)
|
foo = [1, 2, 3] -> (add_one)
|
||||||
|
@ -89,7 +89,7 @@ mod tests {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn evaluate_map_index() {
|
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);
|
assert_eq!(Value::Integer(2), test);
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ mod tests {
|
|||||||
variables.insert("foo".to_string(), Value::String("bar".to_string()));
|
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]
|
#[test]
|
||||||
|
@ -39,20 +39,6 @@ fn fibonacci() {
|
|||||||
evaluate(&file_contents).unwrap();
|
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]
|
#[test]
|
||||||
fn fizzbuzz() {
|
fn fizzbuzz() {
|
||||||
let file_contents = read_to_string("examples/fizzbuzz.ds").unwrap();
|
let file_contents = read_to_string("examples/fizzbuzz.ds").unwrap();
|
||||||
@ -102,13 +88,6 @@ fn random() {
|
|||||||
evaluate(&file_contents).unwrap();
|
evaluate(&file_contents).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn remove_loop() {
|
|
||||||
let file_contents = read_to_string("examples/remove_loop.ds").unwrap();
|
|
||||||
|
|
||||||
evaluate(&file_contents).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn sea_creatures() {
|
fn sea_creatures() {
|
||||||
let file_contents = read_to_string("examples/sea_creatures.ds").unwrap();
|
let file_contents = read_to_string("examples/sea_creatures.ds").unwrap();
|
||||||
@ -130,13 +109,6 @@ fn table() {
|
|||||||
evaluate(&file_contents).unwrap();
|
evaluate(&file_contents).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn transform_loop() {
|
|
||||||
let file_contents = read_to_string("examples/transform_loop.ds").unwrap();
|
|
||||||
|
|
||||||
evaluate(&file_contents).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn variables() {
|
fn variables() {
|
||||||
let file_contents = read_to_string("examples/variables.ds").unwrap();
|
let file_contents = read_to_string("examples/variables.ds").unwrap();
|
||||||
|
Loading…
Reference in New Issue
Block a user