about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2021-01-28 15:09:17 +0900
committerGitHub <noreply@github.com>2021-01-28 15:09:17 +0900
commitd56360d495a46e447575d54fab29421316506642 (patch)
tree246f86804c7ed2440bb1e43e53da849a0e557724 /src
parentf183e5f04c0576ec4dedefe3c7caaafaade3f267 (diff)
parenta7625f88f1bf3fc5f0aab9dd27eb60e867f28eea (diff)
downloadrust-d56360d495a46e447575d54fab29421316506642.tar.gz
rust-d56360d495a46e447575d54fab29421316506642.zip
Rollup merge of #81428 - phansch:compiletest-tests, r=Mark-Simulacrum
compiletest: Add two more unit tests

This adds two more unit tests and fixes spelling in `compiletest`.
Diffstat (limited to 'src')
-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 5424889a838..c8e76743231 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(""));
+}