From 9096447c703f0ce60bb4af976bc43d4fa14b9aeb Mon Sep 17 00:00:00 2001 From: Sunshine Date: Sun, 17 Oct 2021 22:46:06 -1000 Subject: [PATCH] move test data files under _data_ --- tests/{data => _data_}/basic/local-file.html | 0 tests/{data => _data_}/basic/local-script.js | 0 tests/{data => _data_}/basic/local-style.css | 0 tests/{data => _data_}/css/index.html | 0 tests/{data => _data_}/css/style.css | 0 .../import-css-via-data-url/index.html | 0 .../import-css-via-data-url/style.css | 0 tests/{data => _data_}/integrity/index.html | 0 tests/{data => _data_}/integrity/script.js | 0 tests/{data => _data_}/integrity/style.css | 0 tests/{data => _data_}/noscript/image.svg | 0 tests/{data => _data_}/noscript/index.html | 0 tests/{data => _data_}/noscript/nested.html | 0 tests/{data => _data_}/noscript/script.html | 0 tests/{data => _data_}/svg/image.svg | 0 tests/{data => _data_}/svg/index.html | 0 .../unusual_encodings/gb2312.html | 0 .../unusual_encodings/iso-8859-1.html | 0 tests/cli/basic.rs | 4 +-- tests/cli/local_files.rs | 36 +++++++++---------- tests/cli/noscript.rs | 16 ++++----- tests/cli/unusual_encodings.rs | 16 ++++----- tests/utils/retrieve_asset.rs | 6 ++-- 23 files changed, 39 insertions(+), 39 deletions(-) rename tests/{data => _data_}/basic/local-file.html (100%) rename tests/{data => _data_}/basic/local-script.js (100%) rename tests/{data => _data_}/basic/local-style.css (100%) rename tests/{data => _data_}/css/index.html (100%) rename tests/{data => _data_}/css/style.css (100%) rename tests/{data => _data_}/import-css-via-data-url/index.html (100%) rename tests/{data => _data_}/import-css-via-data-url/style.css (100%) rename tests/{data => _data_}/integrity/index.html (100%) rename tests/{data => _data_}/integrity/script.js (100%) rename tests/{data => _data_}/integrity/style.css (100%) rename tests/{data => _data_}/noscript/image.svg (100%) rename tests/{data => _data_}/noscript/index.html (100%) rename tests/{data => _data_}/noscript/nested.html (100%) rename tests/{data => _data_}/noscript/script.html (100%) rename tests/{data => _data_}/svg/image.svg (100%) rename tests/{data => _data_}/svg/index.html (100%) rename tests/{data => _data_}/unusual_encodings/gb2312.html (100%) rename tests/{data => _data_}/unusual_encodings/iso-8859-1.html (100%) diff --git a/tests/data/basic/local-file.html b/tests/_data_/basic/local-file.html similarity index 100% rename from tests/data/basic/local-file.html rename to tests/_data_/basic/local-file.html diff --git a/tests/data/basic/local-script.js b/tests/_data_/basic/local-script.js similarity index 100% rename from tests/data/basic/local-script.js rename to tests/_data_/basic/local-script.js diff --git a/tests/data/basic/local-style.css b/tests/_data_/basic/local-style.css similarity index 100% rename from tests/data/basic/local-style.css rename to tests/_data_/basic/local-style.css diff --git a/tests/data/css/index.html b/tests/_data_/css/index.html similarity index 100% rename from tests/data/css/index.html rename to tests/_data_/css/index.html diff --git a/tests/data/css/style.css b/tests/_data_/css/style.css similarity index 100% rename from tests/data/css/style.css rename to tests/_data_/css/style.css diff --git a/tests/data/import-css-via-data-url/index.html b/tests/_data_/import-css-via-data-url/index.html similarity index 100% rename from tests/data/import-css-via-data-url/index.html rename to tests/_data_/import-css-via-data-url/index.html diff --git a/tests/data/import-css-via-data-url/style.css b/tests/_data_/import-css-via-data-url/style.css similarity index 100% rename from tests/data/import-css-via-data-url/style.css rename to tests/_data_/import-css-via-data-url/style.css diff --git a/tests/data/integrity/index.html b/tests/_data_/integrity/index.html similarity index 100% rename from tests/data/integrity/index.html rename to tests/_data_/integrity/index.html diff --git a/tests/data/integrity/script.js b/tests/_data_/integrity/script.js similarity index 100% rename from tests/data/integrity/script.js rename to tests/_data_/integrity/script.js diff --git a/tests/data/integrity/style.css b/tests/_data_/integrity/style.css similarity index 100% rename from tests/data/integrity/style.css rename to tests/_data_/integrity/style.css diff --git a/tests/data/noscript/image.svg b/tests/_data_/noscript/image.svg similarity index 100% rename from tests/data/noscript/image.svg rename to tests/_data_/noscript/image.svg diff --git a/tests/data/noscript/index.html b/tests/_data_/noscript/index.html similarity index 100% rename from tests/data/noscript/index.html rename to tests/_data_/noscript/index.html diff --git a/tests/data/noscript/nested.html b/tests/_data_/noscript/nested.html similarity index 100% rename from tests/data/noscript/nested.html rename to tests/_data_/noscript/nested.html diff --git a/tests/data/noscript/script.html b/tests/_data_/noscript/script.html similarity index 100% rename from tests/data/noscript/script.html rename to tests/_data_/noscript/script.html diff --git a/tests/data/svg/image.svg b/tests/_data_/svg/image.svg similarity index 100% rename from tests/data/svg/image.svg rename to tests/_data_/svg/image.svg diff --git a/tests/data/svg/index.html b/tests/_data_/svg/index.html similarity index 100% rename from tests/data/svg/index.html rename to tests/_data_/svg/index.html diff --git a/tests/data/unusual_encodings/gb2312.html b/tests/_data_/unusual_encodings/gb2312.html similarity index 100% rename from tests/data/unusual_encodings/gb2312.html rename to tests/_data_/unusual_encodings/gb2312.html diff --git a/tests/data/unusual_encodings/iso-8859-1.html b/tests/_data_/unusual_encodings/iso-8859-1.html similarity index 100% rename from tests/data/unusual_encodings/iso-8859-1.html rename to tests/_data_/unusual_encodings/iso-8859-1.html diff --git a/tests/cli/basic.rs b/tests/cli/basic.rs index 0304626..943c906 100644 --- a/tests/cli/basic.rs +++ b/tests/cli/basic.rs @@ -77,8 +77,8 @@ mod passing { #[test] fn css_import_string() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/css/index.html"); - let path_css: &Path = Path::new("tests/data/css/style.css"); + let path_html: &Path = Path::new("tests/_data_/css/index.html"); + let path_css: &Path = Path::new("tests/_data_/css/style.css"); assert!(path_html.is_file()); assert!(path_css.is_file()); diff --git a/tests/cli/local_files.rs b/tests/cli/local_files.rs index 5304059..f1fb39f 100644 --- a/tests/cli/local_files.rs +++ b/tests/cli/local_files.rs @@ -27,7 +27,7 @@ mod passing { let out = cmd .arg("-M") .arg(format!( - "tests{s}data{s}basic{s}local-file.html", + "tests{s}_data_{s}basic{s}local-file.html", s = MAIN_SEPARATOR )) .output() @@ -39,11 +39,11 @@ mod passing { String::from_utf8_lossy(&out.stderr), format!( "\ - {file}{cwd}/tests/data/basic/local-file.html\n \ - {file}{cwd}/tests/data/basic/local-style.css\n \ - {file}{cwd}/tests/data/basic/local-style-does-not-exist.css (not found)\n \ - {file}{cwd}/tests/data/basic/monolith.png (not found)\n \ - {file}{cwd}/tests/data/basic/local-script.js\n\ + {file}{cwd}/tests/_data_/basic/local-file.html\n \ + {file}{cwd}/tests/_data_/basic/local-style.css\n \ + {file}{cwd}/tests/_data_/basic/local-style-does-not-exist.css (not found)\n \ + {file}{cwd}/tests/_data_/basic/monolith.png (not found)\n \ + {file}{cwd}/tests/_data_/basic/local-script.js\n\ ", file = file_url_protocol, cwd = cwd_normalized @@ -74,7 +74,7 @@ mod passing { #[test] fn local_file_target_input_absolute_target_path() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/basic/local-file.html"); + let path_html: &Path = Path::new("tests/_data_/basic/local-file.html"); let out = cmd .arg("-M") @@ -130,7 +130,7 @@ mod passing { .arg("-M") .arg("-cji") .arg(format!( - "{file}{cwd}/tests/data/basic/local-file.html", + "{file}{cwd}/tests/_data_/basic/local-file.html", file = file_url_protocol, cwd = cwd_normalized, )) @@ -141,7 +141,7 @@ mod passing { assert_eq!( String::from_utf8_lossy(&out.stderr), format!( - "{file}{cwd}/tests/data/basic/local-file.html\n", + "{file}{cwd}/tests/_data_/basic/local-file.html\n", file = file_url_protocol, cwd = cwd_normalized, ) @@ -175,8 +175,8 @@ mod passing { #[test] fn embed_file_url_local_asset_within_style_attribute() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/svg/index.html"); - let path_svg: &Path = Path::new("tests/data/svg/image.svg"); + let path_html: &Path = Path::new("tests/_data_/svg/index.html"); + let path_svg: &Path = Path::new("tests/_data_/svg/image.svg"); let out = cmd.arg("-M").arg(path_html.as_os_str()).output().unwrap(); @@ -217,13 +217,13 @@ mod passing { .arg("-i") .arg(if cfg!(windows) { format!( - "{file}{cwd}/tests/data/integrity/index.html", + "{file}{cwd}/tests/_data_/integrity/index.html", file = file_url_protocol, cwd = cwd_normalized, ) } else { format!( - "{file}{cwd}/tests/data/integrity/index.html", + "{file}{cwd}/tests/_data_/integrity/index.html", file = file_url_protocol, cwd = cwd_normalized, ) @@ -236,11 +236,11 @@ mod passing { String::from_utf8_lossy(&out.stderr), format!( "\ - {file}{cwd}/tests/data/integrity/index.html\n \ - {file}{cwd}/tests/data/integrity/style.css\n \ - {file}{cwd}/tests/data/integrity/style.css\n \ - {file}{cwd}/tests/data/integrity/script.js\n \ - {file}{cwd}/tests/data/integrity/script.js\n\ + {file}{cwd}/tests/_data_/integrity/index.html\n \ + {file}{cwd}/tests/_data_/integrity/style.css\n \ + {file}{cwd}/tests/_data_/integrity/style.css\n \ + {file}{cwd}/tests/_data_/integrity/script.js\n \ + {file}{cwd}/tests/_data_/integrity/script.js\n\ ", file = file_url_protocol, cwd = cwd_normalized, diff --git a/tests/cli/noscript.rs b/tests/cli/noscript.rs index f988eda..9195cc1 100644 --- a/tests/cli/noscript.rs +++ b/tests/cli/noscript.rs @@ -17,8 +17,8 @@ mod passing { #[test] fn parse_noscript_contents() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/noscript/index.html"); - let path_svg: &Path = Path::new("tests/data/noscript/image.svg"); + let path_html: &Path = Path::new("tests/_data_/noscript/index.html"); + let path_svg: &Path = Path::new("tests/_data_/noscript/image.svg"); let out = cmd.arg("-M").arg(path_html.as_os_str()).output().unwrap(); @@ -48,8 +48,8 @@ mod passing { #[test] fn unwrap_noscript_contents() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/noscript/index.html"); - let path_svg: &Path = Path::new("tests/data/noscript/image.svg"); + let path_html: &Path = Path::new("tests/_data_/noscript/index.html"); + let path_svg: &Path = Path::new("tests/_data_/noscript/image.svg"); let out = cmd.arg("-Mn").arg(path_html.as_os_str()).output().unwrap(); @@ -79,8 +79,8 @@ mod passing { #[test] fn unwrap_noscript_contents_nested() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/noscript/nested.html"); - let path_svg: &Path = Path::new("tests/data/noscript/image.svg"); + let path_html: &Path = Path::new("tests/_data_/noscript/nested.html"); + let path_svg: &Path = Path::new("tests/_data_/noscript/image.svg"); let out = cmd.arg("-Mn").arg(path_html.as_os_str()).output().unwrap(); @@ -110,8 +110,8 @@ mod passing { #[test] fn unwrap_noscript_contents_with_script() { let mut cmd = Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap(); - let path_html: &Path = Path::new("tests/data/noscript/script.html"); - let path_svg: &Path = Path::new("tests/data/noscript/image.svg"); + let path_html: &Path = Path::new("tests/_data_/noscript/script.html"); + let path_svg: &Path = Path::new("tests/_data_/noscript/image.svg"); let out = cmd.arg("-Mn").arg(path_html.as_os_str()).output().unwrap(); diff --git a/tests/cli/unusual_encodings.rs b/tests/cli/unusual_encodings.rs index acfa849..2a68c37 100644 --- a/tests/cli/unusual_encodings.rs +++ b/tests/cli/unusual_encodings.rs @@ -21,7 +21,7 @@ mod passing { let out = cmd .arg("-M") .arg(format!( - "tests{s}data{s}unusual_encodings{s}gb2312.html", + "tests{s}_data_{s}unusual_encodings{s}gb2312.html", s = MAIN_SEPARATOR )) .output() @@ -32,7 +32,7 @@ mod passing { assert_eq!( String::from_utf8_lossy(&out.stderr), format!( - "{file}{cwd}/tests/data/unusual_encodings/gb2312.html\n", + "{file}{cwd}/tests/_data_/unusual_encodings/gb2312.html\n", file = file_url_protocol, cwd = cwd_normalized, ) @@ -67,7 +67,7 @@ mod passing { fn properly_save_document_with_gb2312_from_stdin() { let mut echo = Command::new("cat") .arg(format!( - "tests{s}data{s}unusual_encodings{s}gb2312.html", + "tests{s}_data_{s}unusual_encodings{s}gb2312.html", s = MAIN_SEPARATOR )) .stdout(Stdio::piped()) @@ -118,7 +118,7 @@ mod passing { .arg("-C") .arg("utf8") .arg(format!( - "tests{s}data{s}unusual_encodings{s}gb2312.html", + "tests{s}_data_{s}unusual_encodings{s}gb2312.html", s = MAIN_SEPARATOR )) .output() @@ -129,7 +129,7 @@ mod passing { assert_eq!( String::from_utf8_lossy(&out.stderr), format!( - "{file}{cwd}/tests/data/unusual_encodings/gb2312.html\n", + "{file}{cwd}/tests/_data_/unusual_encodings/gb2312.html\n", file = file_url_protocol, cwd = cwd_normalized, ) @@ -161,7 +161,7 @@ mod passing { .arg("-C") .arg("utf0") .arg(format!( - "tests{s}data{s}unusual_encodings{s}gb2312.html", + "tests{s}_data_{s}unusual_encodings{s}gb2312.html", s = MAIN_SEPARATOR )) .output() @@ -203,7 +203,7 @@ mod failing { let out = cmd .arg("-M") .arg(format!( - "tests{s}data{s}unusual_encodings{s}iso-8859-1.html", + "tests{s}_data_{s}unusual_encodings{s}iso-8859-1.html", s = MAIN_SEPARATOR )) .output() @@ -214,7 +214,7 @@ mod failing { assert_eq!( String::from_utf8_lossy(&out.stderr), format!( - "{file}{cwd}/tests/data/unusual_encodings/iso-8859-1.html\n", + "{file}{cwd}/tests/_data_/unusual_encodings/iso-8859-1.html\n", file = file_url_protocol, cwd = cwd_normalized, ) diff --git a/tests/utils/retrieve_asset.rs b/tests/utils/retrieve_asset.rs index 2c61a0d..698c450 100644 --- a/tests/utils/retrieve_asset.rs +++ b/tests/utils/retrieve_asset.rs @@ -63,13 +63,13 @@ mod passing { cache, &client, &Url::parse(&format!( - "{file}{cwd}/tests/data/basic/local-file.html", + "{file}{cwd}/tests/_data_/basic/local-file.html", file = file_url_protocol, cwd = cwd.to_str().unwrap() )) .unwrap(), &Url::parse(&format!( - "{file}{cwd}/tests/data/basic/local-script.js", + "{file}{cwd}/tests/_data_/basic/local-script.js", file = file_url_protocol, cwd = cwd.to_str().unwrap() )) @@ -84,7 +84,7 @@ mod passing { assert_eq!( final_url, Url::parse(&format!( - "{file}{cwd}/tests/data/basic/local-script.js", + "{file}{cwd}/tests/_data_/basic/local-script.js", file = file_url_protocol, cwd = cwd.to_str().unwrap() ))