Skip to content

Commit

Permalink
compiletest: Add two more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
phansch committed Jan 27, 2021
1 parent 90ccf4f commit a7625f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl fmt::Display for Debugger {
/// Configuration for compiletest
#[derive(Debug, Clone)]
pub struct Config {
/// `true` to to overwrite stderr/stdout files instead of complaining about changes in output.
/// `true` to overwrite stderr/stdout files instead of complaining about changes in output.
pub bless: bool,

/// The library paths required for running the compiler.
Expand Down
19 changes: 19 additions & 0 deletions src/tools/compiletest/src/util/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ fn test_matches_os() {
assert!(matches_os("nvptx64-nvidia-cuda", "cuda"));
assert!(matches_os("x86_64-fortanix-unknown-sgx", "sgx"));
}

#[test]
fn is_big_endian_test() {
assert!(!is_big_endian("no"));
assert!(is_big_endian("sparc-unknown-unknown"));
}

#[test]
fn path_buf_with_extra_extension_test() {
assert_eq!(
PathBuf::from("foo.rs.stderr"),
PathBuf::from("foo.rs").with_extra_extension("stderr")
);
assert_eq!(
PathBuf::from("foo.rs.stderr"),
PathBuf::from("foo.rs").with_extra_extension(".stderr")
);
assert_eq!(PathBuf::from("foo.rs"), PathBuf::from("foo.rs").with_extra_extension(""));
}

0 comments on commit a7625f8

Please sign in to comment.