summaryrefslogtreecommitdiffstats
path: root/src/tools/compiletest/src/runtest/tests.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tools/compiletest/src/runtest/tests.rs')
-rw-r--r--src/tools/compiletest/src/runtest/tests.rs50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/tools/compiletest/src/runtest/tests.rs b/src/tools/compiletest/src/runtest/tests.rs
new file mode 100644
index 000000000..511051111
--- /dev/null
+++ b/src/tools/compiletest/src/runtest/tests.rs
@@ -0,0 +1,50 @@
+use super::*;
+
+#[test]
+fn normalize_platform_differences() {
+ assert_eq!(TestCx::normalize_platform_differences(r"$DIR\foo.rs"), "$DIR/foo.rs");
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$BUILD_DIR\..\parser.rs"),
+ "$BUILD_DIR/../parser.rs"
+ );
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$DIR\bar.rs hello\nworld"),
+ r"$DIR/bar.rs hello\nworld"
+ );
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"either bar\baz.rs or bar\baz\mod.rs"),
+ r"either bar/baz.rs or bar/baz/mod.rs",
+ );
+ assert_eq!(TestCx::normalize_platform_differences(r"`.\some\path.rs`"), r"`./some/path.rs`",);
+ assert_eq!(TestCx::normalize_platform_differences(r"`some\path.rs`"), r"`some/path.rs`",);
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$DIR\path-with-dashes.rs"),
+ r"$DIR/path-with-dashes.rs"
+ );
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$DIR\path_with_underscores.rs"),
+ r"$DIR/path_with_underscores.rs",
+ );
+ assert_eq!(TestCx::normalize_platform_differences(r"$DIR\foo.rs:12:11"), "$DIR/foo.rs:12:11",);
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$DIR\path with spaces 'n' quotes"),
+ "$DIR/path with spaces 'n' quotes",
+ );
+ assert_eq!(
+ TestCx::normalize_platform_differences(r"$DIR\file_with\no_extension"),
+ "$DIR/file_with/no_extension",
+ );
+
+ assert_eq!(TestCx::normalize_platform_differences(r"\n"), r"\n");
+ assert_eq!(TestCx::normalize_platform_differences(r"{ \n"), r"{ \n");
+ assert_eq!(TestCx::normalize_platform_differences(r"`\]`"), r"`\]`");
+ assert_eq!(TestCx::normalize_platform_differences(r#""\{""#), r#""\{""#);
+ assert_eq!(
+ TestCx::normalize_platform_differences(r#"write!(&mut v, "Hello\n")"#),
+ r#"write!(&mut v, "Hello\n")"#
+ );
+ assert_eq!(
+ TestCx::normalize_platform_differences(r#"println!("test\ntest")"#),
+ r#"println!("test\ntest")"#,
+ );
+}