Skip to content

Commit

Permalink
Minor linting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Jan 3, 2022
1 parent 4226143 commit 630f024
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _fmt:

# Run clippy
_clippy:
cargo +nightly clippy
cargo +nightly clippy --all-features --all-targets

_deny:
cargo deny check
Expand Down
22 changes: 13 additions & 9 deletions src/wrapped_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,41 +184,45 @@ mod test_context {
fn test_get_type_json() {
let data = json!({
"name": "John Doe",
"age": 43,
"age": 43u8,
"phones": [
"+44 1234567",
"+44 2345678"
]
});
})
.to_string();

assert!(WrappedContext::get_type(&data.to_string()) == Some(SupportedType::Json));
assert!(WrappedContext::get_type(&data) == Some(SupportedType::Json));
}

#[test]
fn test_get_type_toml() {
let data = r##"
name = "John"
age = 42
"##;
"##
.to_string();

assert!(WrappedContext::get_type(&data.to_string()) == Some(SupportedType::Toml));
assert!(WrappedContext::get_type(&data) == Some(SupportedType::Toml));
}

#[test]
fn test_get_type_yaml() {
let data = r##"
name: "Bob"
ag: 42
"##;
assert!(WrappedContext::get_type(&data.to_string()) == Some(SupportedType::Yaml));
"##
.to_string();
assert!(WrappedContext::get_type(&data) == Some(SupportedType::Yaml));
}

#[test]
fn test_get_type_na() {
let data = r##"
foobar
"##;
"##
.to_string();

assert!(WrappedContext::get_type(&data.to_string()) == None);
assert!(WrappedContext::get_type(&data) == None);
}
}

0 comments on commit 630f024

Please sign in to comment.