Skip to content

Commit

Permalink
tests: Removed the need for test framework to depend on libtest_mimic
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinnerbone committed Nov 10, 2023
1 parent 2b450af commit eb72cfb
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

1 change: 0 additions & 1 deletion tests/framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ tracing = { workspace = true}
tracing-subscriber = { workspace = true }
serde = "1.0.190"
toml = "0.8.6"
libtest-mimic = "0.6.1"
anyhow = "1.0.75"
async-channel = "1.9.0"

Expand Down
6 changes: 3 additions & 3 deletions tests/framework/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Test {
mut before_start: impl FnMut(Arc<Mutex<Player>>) -> Result<()>,
mut before_end: impl FnMut(Arc<Mutex<Player>>) -> Result<()>,
environment: &impl Environment,
) -> std::result::Result<(), libtest_mimic::Failed> {
) -> Result<()> {
set_logger();
let movie =
SwfMovie::from_path(&self.swf_path, None).map_err(|e| anyhow!(e.to_string()))?;
Expand Down Expand Up @@ -93,15 +93,15 @@ impl Test {
Ok(())
}

fn socket_events(&self) -> Result<Option<Vec<SocketEvent>>, libtest_mimic::Failed> {
fn socket_events(&self) -> Result<Option<Vec<SocketEvent>>> {
Ok(if self.socket_path.is_file() {
Some(SocketEvent::from_file(&self.socket_path)?)
} else {
None
})
}

fn input_injector(&self) -> Result<InputInjector, libtest_mimic::Failed> {
fn input_injector(&self) -> Result<InputInjector> {
Ok(if self.input_path.is_file() {
InputInjector::from_file(&self.input_path)?
} else {
Expand Down
8 changes: 4 additions & 4 deletions tests/tests/external_interface/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub fn external_interface_avm1(
environment: &impl Environment,
) -> Result<(), libtest_mimic::Failed> {
set_logger();
Test::from_options(
Ok(Test::from_options(
TestOptions {
num_frames: Some(1),
..Default::default()
Expand Down Expand Up @@ -63,14 +63,14 @@ pub fn external_interface_avm1(
Ok(())
},
environment,
)
)?)
}

pub fn external_interface_avm2(
environment: &impl Environment,
) -> Result<(), libtest_mimic::Failed> {
set_logger();
Test::from_options(
Ok(Test::from_options(
TestOptions {
num_frames: Some(1),
..Default::default()
Expand Down Expand Up @@ -113,5 +113,5 @@ pub fn external_interface_avm2(
Ok(())
},
environment,
)
)?)
}
2 changes: 1 addition & 1 deletion tests/tests/regression_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn main() {
}
} else {
match unwind_result {
Ok(r) => r,
Ok(r) => Ok(r?),
Err(e) => resume_unwind(e),
}
}
Expand Down

0 comments on commit eb72cfb

Please sign in to comment.