Skip to content

Commit

Permalink
Add explicit check for exit code from snapshot tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Arshia001 committed Oct 23, 2024
1 parent e772910 commit d8053e3
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/integration/cli/tests/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1288,6 +1288,10 @@ fn test_snapshot_exit_0_from_main() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/exit-0-from-main.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 0, .. })
));
assert_json_snapshot!(snapshot);
}

Expand All @@ -1297,6 +1301,10 @@ fn test_snapshot_exit_1_from_main() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/exit-1-from-main.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 1, .. })
));
assert_json_snapshot!(snapshot);
}

Expand All @@ -1306,6 +1314,10 @@ fn test_snapshot_exit_0_from_worker() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/exit-0-from-worker.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 0, .. })
));
assert_json_snapshot!(snapshot);
}

Expand All @@ -1315,6 +1327,10 @@ fn test_snapshot_exit_1_from_worker() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/exit-1-from-worker.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 1, .. })
));
assert_json_snapshot!(snapshot);
}

Expand All @@ -1324,6 +1340,10 @@ fn test_snapshot_worker_terminating_normally() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/worker-terminating-normally.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 0, .. })
));
assert_json_snapshot!(snapshot);
}

Expand All @@ -1333,5 +1353,9 @@ fn test_snapshot_worker_panicking() {
let snapshot = TestBuilder::new()
.with_name(function!())
.run_wasm(include_bytes!("./wasm/worker-panicking.wasm"));
assert!(matches!(
snapshot.result,
TestResult::Success(TestOutput { exit_code: 173, .. })
));
assert_json_snapshot!(snapshot);
}

0 comments on commit d8053e3

Please sign in to comment.