Skip to content

Commit a18a2a3

Browse files
committed
Merge branch 'master' into fix_testdata_runner
2 parents 887d908 + c34de27 commit a18a2a3

File tree

17 files changed

+63
-66
lines changed

17 files changed

+63
-66
lines changed

.github/workflows/codecov.yml

Lines changed: 4 additions & 4 deletions
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/tarpaulin@v0.1
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

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ name: CI
22

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

88
jobs:
99
Test:
1010
strategy:
1111
matrix:
1212
os: [ubuntu-latest, macos-latest, windows-latest]
13-
rust: [1.36.0, stable, beta, nightly]
13+
rust: [1.45.0, stable, beta, nightly]
1414
exclude:
1515
- os: macos-latest
16-
rust: 1.36.0
16+
rust: 1.45.0
1717
- os: windows-latest
18-
rust: 1.36.0
18+
rust: 1.45.0
1919
- os: macos-latest
2020
rust: beta
2121
- os: windows-latest
@@ -81,5 +81,5 @@ jobs:
8181
Audit:
8282
runs-on: ubuntu-latest
8383
steps:
84-
- uses: actions/checkout@v1
85-
- uses: EmbarkStudios/cargo-deny-action@v1
84+
- uses: actions/checkout@v1
85+
- uses: EmbarkStudios/cargo-deny-action@v1

LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2013-2016 The rust-url developers
1+
Copyright (c) 2013-2022 The rust-url developers
22

33
Permission is hereby granted, free of charge, to any
44
person obtaining a copy of this software and associated

data-url/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@ repository = "https://github.com/servo/rust-url"
77
license = "MIT OR Apache-2.0"
88
edition = "2018"
99
autotests = false
10+
rust-version = "1.45"
1011

1112
[dependencies]
1213
matches = "0.1"
1314

1415
[dev-dependencies]
15-
rustc-test = "0.3"
16+
tester = "0.9"
1617
serde = {version = "1.0", features = ["derive"]}
1718
serde_json = "1.0"
1819

data-url/src/mime.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ fn split2(s: &str, separator: char) -> (&str, Option<&str>) {
6262
(first, iter.next())
6363
}
6464

65-
#[allow(clippy::manual_strip)] // introduced in 1.45, MSRV is 1.36
6665
fn parse_parameters(s: &str, parameters: &mut Vec<(String, String)>) {
6766
let mut semicolon_separated = s.split(';');
6867

@@ -73,10 +72,10 @@ fn parse_parameters(s: &str, parameters: &mut Vec<(String, String)>) {
7372
continue;
7473
}
7574
if let Some(value) = value {
76-
let value = if value.starts_with('"') {
77-
let max_len = value.len().saturating_sub(2); // without start or end quotes
75+
let value = if let Some(stripped) = value.strip_prefix('"') {
76+
let max_len = stripped.len().saturating_sub(1); // without end quote
7877
let mut unescaped_value = String::with_capacity(max_len);
79-
let mut chars = value[1..].chars();
78+
let mut chars = stripped.chars();
8079
'until_closing_quote: loop {
8180
while let Some(c) = chars.next() {
8281
match c {

data-url/tests/wpt.rs

Lines changed: 22 additions & 14 deletions
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
}

form_urlencoded/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ description = "Parser and serializer for the application/x-www-form-urlencoded s
66
repository = "https://github.com/servo/rust-url"
77
license = "MIT/Apache-2.0"
88
edition = "2018"
9+
rust-version = "1.45"
910

1011
[lib]
1112
test = false

idna/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ repository = "https://github.com/servo/rust-url/"
77
license = "MIT/Apache-2.0"
88
autotests = false
99
edition = "2018"
10+
rust-version = "1.45"
1011

1112
[lib]
1213
doctest = false
@@ -21,7 +22,7 @@ name = "unit"
2122
[dev-dependencies]
2223
assert_matches = "1.3"
2324
bencher = "0.1"
24-
rustc-test = "0.3"
25+
tester = "0.9"
2526
serde_json = "1.0"
2627

2728
[dependencies]

idna/src/uts46.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ fn check_validity(label: &str, config: Config, errors: &mut Errors) {
319319
}
320320

321321
/// http://www.unicode.org/reports/tr46/#Processing
322-
#[allow(clippy::manual_strip)] // introduced in 1.45, MSRV is 1.36
323322
fn processing(
324323
domain: &str,
325324
config: Config,
@@ -384,8 +383,8 @@ fn processing(
384383
output.push('.');
385384
}
386385
first = false;
387-
if label.starts_with(PUNYCODE_PREFIX) {
388-
match decoder.decode(&label[PUNYCODE_PREFIX.len()..]) {
386+
if let Some(remainder) = label.strip_prefix(PUNYCODE_PREFIX) {
387+
match decoder.decode(remainder) {
389388
Ok(decode) => {
390389
let start = output.len();
391390
output.extend(decode);

idna/tests/punycode.rs

Lines changed: 2 additions & 2 deletions
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!(),

0 commit comments

Comments
 (0)