Skip to content

Commit c34de27

Browse files
authored
Merge pull request #748 from lucacasonato/use_tester_not_rustc_test
Use `tester` instead of `rustc-test`
2 parents 474560d + 26f5371 commit c34de27

File tree

7 files changed

+41
-27
lines changed

7 files changed

+41
-27
lines changed

.github/workflows/codecov.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Coverage
22

33
on:
44
push:
5-
branches: ['master']
5+
branches: ["master"]
66
pull_request:
77

88
jobs:
@@ -16,9 +16,9 @@ jobs:
1616
toolchain: stable
1717
override: true
1818
- uses: actions-rs/[email protected]
19-
- uses: codecov/codecov-action@v1.0.2
20-
with:
21-
token: ${{secrets.CODECOV_TOKEN}}
19+
- uses: codecov/codecov-action@v2.1.0
20+
# A codecov token is not needed for public repos if the repo is linked
21+
# on codecov.io. See https://docs.codecov.com/docs/frequently-asked-questions#where-is-the-repository-upload-token-found
2222
- uses: actions/upload-artifact@v1
2323
with:
2424
name: code-coverage-report

data-url/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rust-version = "1.45"
1313
matches = "0.1"
1414

1515
[dev-dependencies]
16-
rustc-test = "0.3"
16+
tester = "0.9"
1717
serde = {version = "1.0", features = ["derive"]}
1818
serde_json = "1.0"
1919

data-url/tests/wpt.rs

+22-14
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use tester as test;
2+
13
#[macro_use]
24
extern crate serde;
35

@@ -32,7 +34,7 @@ fn run_data_url(
3234

3335
fn collect_data_url<F>(add_test: &mut F)
3436
where
35-
F: FnMut(String, bool, rustc_test::TestFn),
37+
F: FnMut(String, bool, test::TestFn),
3638
{
3739
let known_failures = ["data://test:test/,X"];
3840

@@ -53,9 +55,9 @@ where
5355
add_test(
5456
format!("data: URL {:?}", input),
5557
should_panic,
56-
rustc_test::TestFn::dyn_test_fn(move || {
58+
test::TestFn::DynTestFn(Box::new(move || {
5759
run_data_url(input, expected_mime, expected_body, should_panic)
58-
}),
60+
})),
5961
);
6062
}
6163
}
@@ -72,7 +74,7 @@ fn run_base64(input: String, expected: Option<Vec<u8>>) {
7274

7375
fn collect_base64<F>(add_test: &mut F)
7476
where
75-
F: FnMut(String, bool, rustc_test::TestFn),
77+
F: FnMut(String, bool, test::TestFn),
7678
{
7779
let known_failures = [];
7880

@@ -83,7 +85,7 @@ where
8385
add_test(
8486
format!("base64 {:?}", input),
8587
should_panic,
86-
rustc_test::TestFn::dyn_test_fn(move || run_base64(input, expected)),
88+
test::TestFn::DynTestFn(Box::new(move || run_base64(input, expected))),
8789
);
8890
}
8991
}
@@ -100,7 +102,7 @@ fn run_mime(input: String, expected: Option<String>) {
100102

101103
fn collect_mime<F>(add_test: &mut F)
102104
where
103-
F: FnMut(String, bool, rustc_test::TestFn),
105+
F: FnMut(String, bool, test::TestFn),
104106
{
105107
let known_failures = [];
106108

@@ -136,24 +138,30 @@ where
136138
format!("MIME type {:?}", input)
137139
},
138140
should_panic,
139-
rustc_test::TestFn::dyn_test_fn(move || run_mime(input, expected)),
141+
test::TestFn::DynTestFn(Box::new(move || run_mime(input, expected))),
140142
);
141143
}
142144
}
143145

144146
fn main() {
145147
let mut tests = Vec::new();
146148
{
147-
let mut add_one = |name: String, should_panic: bool, run: rustc_test::TestFn| {
148-
let mut desc = rustc_test::TestDesc::new(rustc_test::DynTestName(name));
149-
if should_panic {
150-
desc.should_panic = rustc_test::ShouldPanic::Yes
151-
}
152-
tests.push(rustc_test::TestDescAndFn { desc, testfn: run })
149+
let mut add_one = |name: String, should_panic: bool, run: test::TestFn| {
150+
let desc = test::TestDesc {
151+
name: test::DynTestName(name),
152+
ignore: false,
153+
should_panic: match should_panic {
154+
true => test::ShouldPanic::Yes,
155+
false => test::ShouldPanic::No,
156+
},
157+
allow_fail: false,
158+
test_type: test::TestType::Unknown,
159+
};
160+
tests.push(test::TestDescAndFn { desc, testfn: run })
153161
};
154162
collect_data_url(&mut add_one);
155163
collect_base64(&mut add_one);
156164
collect_mime(&mut add_one);
157165
}
158-
rustc_test::test_main(&std::env::args().collect::<Vec<_>>(), tests)
166+
test::test_main(&std::env::args().collect::<Vec<_>>(), tests, None)
159167
}

idna/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ name = "unit"
2222
[dev-dependencies]
2323
assert_matches = "1.3"
2424
bencher = "0.1"
25-
rustc-test = "0.3"
25+
tester = "0.9"
2626
serde_json = "1.0"
2727

2828
[dependencies]

idna/tests/punycode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
6363
};
6464
add_test(
6565
test_name,
66-
TestFn::dyn_test_fn(move || {
66+
TestFn::DynTestFn(Box::new(move || {
6767
one_test(get_string(&o, "decoded"), get_string(&o, "encoded"))
68-
}),
68+
})),
6969
)
7070
}
7171
_ => panic!(),

idna/tests/tests.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use rustc_test as test;
1+
use tester as test;
22

33
mod punycode;
44
mod uts46;
@@ -8,12 +8,18 @@ fn main() {
88
{
99
let mut add_test = |name, run| {
1010
tests.push(test::TestDescAndFn {
11-
desc: test::TestDesc::new(test::DynTestName(name)),
11+
desc: test::TestDesc {
12+
name: test::DynTestName(name),
13+
ignore: false,
14+
should_panic: test::ShouldPanic::No,
15+
allow_fail: false,
16+
test_type: test::TestType::Unknown,
17+
},
1218
testfn: run,
1319
})
1420
};
1521
punycode::collect_tests(&mut add_test);
1622
uts46::collect_tests(&mut add_test);
1723
}
18-
test::test_main(&std::env::args().collect::<Vec<_>>(), tests)
24+
test::test_main(&std::env::args().collect::<Vec<_>>(), tests, None)
1925
}

idna/tests/uts46.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
6565
let test_name = format!("UTS #46 line {}", i + 1);
6666
add_test(
6767
test_name,
68-
TestFn::dyn_test_fn(move || {
68+
TestFn::DynTestFn(Box::new(move || {
6969
let config = idna::Config::default()
7070
.use_std3_ascii_rules(true)
7171
.verify_dns_length(true)
@@ -109,7 +109,7 @@ pub fn collect_tests<F: FnMut(String, TestFn)>(add_test: &mut F) {
109109
to_ascii_t_result,
110110
|e| e.starts_with('C') || e == "V2",
111111
);
112-
}),
112+
})),
113113
)
114114
}
115115
}

0 commit comments

Comments
 (0)