Skip to content

Commit

Permalink
Add runtime tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rozukke committed Sep 15, 2024
1 parent 1ded907 commit 8279ea1
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
38 changes: 36 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ fxhash = "0.2.1"

[dev-dependencies]
assert_cmd = "2.0.14"
predicates = "3.1.2"

[[bin]]
name = "lace"
Expand Down
4 changes: 4 additions & 0 deletions tests/files/hw.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
lea r0 hw
puts
halt
hw .stringz "Hello, world!"
12 changes: 12 additions & 0 deletions tests/integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
use assert_cmd::prelude::*;
use predicates::str::contains;
use std::process::Command;

#[test]
fn runs_without_arguments() {
let mut cmd = Command::cargo_bin("lace").unwrap();
cmd.assert().success();
}

#[test]
fn runs_hello_world() {
let mut cmd = Command::cargo_bin("lace").unwrap();
cmd.arg("run").arg("tests/files/hw.asm");

cmd.assert()
.success()
.stdout(contains("Hello, world!"))
.stdout(contains("Halted"));
}

0 comments on commit 8279ea1

Please sign in to comment.