Skip to content

Commit

Permalink
#111 Implemented for fixture default values
Browse files Browse the repository at this point in the history
  • Loading branch information
la10736 committed Apr 5, 2021
1 parent 9d0af7b commit bcb9c8c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/fixture/mod.rs
Expand Up @@ -179,7 +179,10 @@ mod should {
fn convert_literal_string_for_default_values() {
let (output, _) = run_test("default_conversion.rs");

TestResults::new().ok("test_base").assert(output);
TestResults::new()
.ok("test_base")
.ok("test_byte_array")
.assert(output);
}

#[test]
Expand Down
10 changes: 10 additions & 0 deletions tests/resources/fixture/default_conversion.rs
Expand Up @@ -10,3 +10,13 @@ fn base(#[default = "1.2.3.4"] ip: Ipv4Addr, #[default = r#"8080"#] port: u16) -
fn test_base(base: SocketAddr) {
assert_eq!(base, "1.2.3.4:8080".parse().unwrap());
}

#[fixture]
fn byte_array(#[default = b"1234"] some: &[u8]) -> usize {
some.len()
}

#[rstest]
fn test_byte_array(byte_array: usize) {
assert_eq!(4, byte_array);
}

0 comments on commit bcb9c8c

Please sign in to comment.