Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ license = "AGPL-3.0-or-later"
repository = "https://github.com/wrightkit/wright"

[workspace.dependencies]
# Canonical Workshop core; pinned to the workshop-rs 1.0 release candidate (workshop-rs v0.6.4).
workshop-rs = { git = "https://github.com/wrightkit/workshop-rs.git", rev = "712c839f09f9c4daaf65aa7ae619f4fca065e34d" }
# Canonical Workshop core; pinned to the workshop-rs 1.0 release candidate (workshop-rs v0.7.0).
workshop-rs = { git = "https://github.com/wrightkit/workshop-rs.git", rev = "43a8b45f2703903233f4eba6bd27deb9b6ba675f" }
libc = "0.2"
serde = "1"
serde_json = "1"
Expand Down
60 changes: 29 additions & 31 deletions crates/wright-transform/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,37 +330,35 @@ mod tests {
use workshop_rs::{Action, Condition, Event, Program, Rule, Value};

let mut program = Program::new();
program.rule(Rule {
name: "r".to_string(),
disabled: false,
event: Event::Global,
conditions: vec![Condition::new(Value::call(
"+",
[Value::call("*", [2.0.into(), 3.0.into()]), 4.0.into()],
))],
actions: vec![Action::Call {
name: "probe".to_string(),
args: vec![
Value::Array(vec![
Value::call("+", [1.0.into(), 2.0.into()]),
Value::call("==", [4.0.into(), 4.0.into()]),
]),
Value::call("and", [true.into(), false.into()]),
Value::call(
"valueInArray",
[
Value::Array(vec![1.0.into(), 2.0.into()]),
Value::call("+", [0.0.into(), 0.0.into()]),
],
),
Value::Vector {
x: Box::new(0.0.into()),
y: Box::new(1.0.into()),
z: Box::new(0.0.into()),
},
],
}],
});
program.rule(
Rule::new("r", Event::Global)
.condition(Condition::new(Value::call(
"+",
[Value::call("*", [2.0.into(), 3.0.into()]), 4.0.into()],
)))
.action(Action::Call {
name: "probe".to_string(),
args: vec![
Value::Array(vec![
Value::call("+", [1.0.into(), 2.0.into()]),
Value::call("==", [4.0.into(), 4.0.into()]),
]),
Value::call("and", [true.into(), false.into()]),
Value::call(
"valueInArray",
[
Value::Array(vec![1.0.into(), 2.0.into()]),
Value::call("+", [0.0.into(), 0.0.into()]),
],
),
Value::Vector {
x: Box::new(0.0.into()),
y: Box::new(1.0.into()),
z: Box::new(0.0.into()),
},
],
}),
);

let results = run_canonical(&mut program, Profile::Compat).expect("canonical pipeline");
assert!(results[0].stats.changed > 0);
Expand Down
12 changes: 4 additions & 8 deletions crates/wright-transform/tests/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ fn arithmetic_program() -> Program {
let multiply = Value::call("*", [Value::number(2.0), Value::number(3.0)]);
let add = Value::call("+", [len, multiply]);

program.rule(Rule {
name: "compute".to_string(),
disabled: false,
event: Event::Global,
conditions: vec![],
actions: vec![Action::SetGlobalVariable {
program.rule(
Rule::new("compute", Event::Global).action(Action::SetGlobalVariable {
variable: "result".to_string(),
value: add,
}],
});
}),
);
program
}

Expand Down
Loading