]>
git.proxmox.com Git - rustc.git/blob - vendor/syn/tests/repo/mod.rs
3 use self::progress
::Progress
;
5 use flate2
::read
::GzDecoder
;
11 const REVISION
: &str = "e708cbd91c9cae4426d69270248362b423324556";
14 static EXCLUDE
: &[&str] = &[
15 // Compile-fail expr parameter in const generic position: f::<1 + 2>()
16 "src/test/ui/const-generics/closing-args-token.rs",
17 "src/test/ui/const-generics/const-expression-parameter.rs",
19 // Deprecated anonymous parameter syntax in traits
20 "src/test/ui/issues/issue-13105.rs",
21 "src/test/ui/issues/issue-13775.rs",
22 "src/test/ui/issues/issue-34074.rs",
23 "src/test/ui/proc-macro/trait-fn-args-2015.rs",
25 // Not actually test cases
26 "src/test/rustdoc-ui/test-compile-fail2.rs",
27 "src/test/rustdoc-ui/test-compile-fail3.rs",
28 "src/test/ui/include-single-expr-helper.rs",
29 "src/test/ui/include-single-expr-helper-1.rs",
30 "src/test/ui/json-bom-plus-crlf-multifile-aux.rs",
31 "src/test/ui/lint/expansion-time-include.rs",
32 "src/test/ui/macros/auxiliary/macro-comma-support.rs",
33 "src/test/ui/macros/auxiliary/macro-include-items-expr.rs",
34 "src/test/ui/parser/auxiliary/issue-21146-inc.rs",
37 pub fn base_dir_filter(entry
: &DirEntry
) -> bool
{
38 let path
= entry
.path();
40 return true; // otherwise walkdir does not visit the files
42 if path
.extension().map(|e
| e
!= "rs").unwrap_or(true) {
46 let mut path_string
= path
.to_string_lossy();
48 path_string
= path_string
.replace('
\\'
, "/").into();
50 let path
= if let Some(path
) = path_string
.strip_prefix("tests/rust/") {
53 panic
!("unexpected path in Rust dist: {}", path_string
);
56 if path
.starts_with("src/test/compile-fail") || path
.starts_with("src/test/rustfix") {
60 if path
.starts_with("src/test/ui") {
61 let stderr_path
= entry
.path().with_extension("stderr");
62 if stderr_path
.exists() {
63 // Expected to fail in some way
68 !EXCLUDE
.contains(&path
)
72 pub fn edition(path
: &Path
) -> &'
static str {
73 if path
.ends_with("dyn-2015-no-warnings-without-lints.rs") {
81 let needs_clone
= match fs
::read_to_string("tests/rust/COMMIT") {
83 Ok(contents
) => contents
.trim() != REVISION
,
86 download_and_unpack().unwrap();
88 let mut missing
= String
::new();
89 let test_src
= Path
::new("tests/rust");
90 for exclude
in EXCLUDE
{
91 if !test_src
.join(exclude
).exists() {
92 missing
+= "\ntests/rust/";
96 if !missing
.is_empty() {
97 panic
!("excluded test file does not exist:{}\n", missing
);
101 fn download_and_unpack() -> Result
<()> {
103 "https://github.com/rust-lang/rust/archive/{}.tar.gz",
106 let response
= reqwest
::blocking
::get(&url
)?
.error_for_status()?
;
107 let progress
= Progress
::new(response
);
108 let decoder
= GzDecoder
::new(progress
);
109 let mut archive
= Archive
::new(decoder
);
110 let prefix
= format
!("rust-{}", REVISION
);
112 let tests_rust
= Path
::new("tests/rust");
113 if tests_rust
.exists() {
114 fs
::remove_dir_all(tests_rust
)?
;
117 for entry
in archive
.entries()?
{
118 let mut entry
= entry?
;
119 let path
= entry
.path()?
;
120 if path
== Path
::new("pax_global_header") {
123 let relative
= path
.strip_prefix(&prefix
)?
;
124 let out
= tests_rust
.join(relative
);
128 fs
::write("tests/rust/COMMIT", REVISION
)?
;