Skip to content

Commit

Permalink
Move test that requires "json5" feature to json5 tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Beyer <[email protected]>
  • Loading branch information
matthiasbeyer committed Oct 2, 2021
1 parent bbbabf7 commit 1c3e188
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
16 changes: 0 additions & 16 deletions tests/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,3 @@ fn error_with_path() {
}
}

#[test]
fn test_error_root_not_table() {
match Config::builder()
.add_source(File::from_str(r#"false"#, FileFormat::Json5))
.build()
{
Ok(_) => panic!("Should not merge if root is not a table"),
Err(e) => match e {
ConfigError::FileParse { cause, .. } => assert_eq!(
"invalid type: boolean `false`, expected a map",
format!("{}", cause)
),
_ => panic!("Wrong error: {:?}", e),
},
}
}
17 changes: 17 additions & 0 deletions tests/file_json5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,20 @@ fn test_error_parse() {
)
);
}

#[test]
fn test_error_root_not_table() {
match Config::builder()
.add_source(File::from_str(r#"false"#, FileFormat::Json5))
.build()
{
Ok(_) => panic!("Should not merge if root is not a table"),
Err(e) => match e {
ConfigError::FileParse { cause, .. } => assert_eq!(
"invalid type: boolean `false`, expected a map",
format!("{}", cause)
),
_ => panic!("Wrong error: {:?}", e),
},
}
}

0 comments on commit 1c3e188

Please sign in to comment.