about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPhilipp Hansch <dev@phansch.net>2021-01-27 08:10:35 +0100
committerPhilipp Hansch <dev@phansch.net>2021-01-27 08:37:46 +0100
commita7625f88f1bf3fc5f0aab9dd27eb60e867f28eea (patch)
tree027e36589dd3fc46d698ee5307eaf0e97b5d5ed3
parent90ccf4f5adfb2562fc95c996b97faac7775a34bb (diff)
downloadrust-a7625f88f1bf3fc5f0aab9dd27eb60e867f28eea.tar.gz
rust-a7625f88f1bf3fc5f0aab9dd27eb60e867f28eea.zip
compiletest: Add two more unit tests
-rw-r--r--src/tools/compiletest/src/common.rs2
-rw-r--r--src/tools/compiletest/src/util/tests.rs19
2 files changed, 20 insertions, 1 deletions
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index 43dbaeb4655..9f88ed6e4e4 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -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.
diff --git a/src/tools/compiletest/src/util/tests.rs b/src/tools/compiletest/src/util/tests.rs
index 55bf659ba28..663027173ff 100644
--- a/src/tools/compiletest/src/util/tests.rs
+++ b/src/tools/compiletest/src/util/tests.rs
@@ -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(""));
+}