Skip to content

Commit 9a6d858

Browse files
committed
Rename cargo test-examples to cargo xtask test-examples
1 parent c524def commit 9a6d858

File tree

6 files changed

+27
-14
lines changed

6 files changed

+27
-14
lines changed

.cargo/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[alias]
2-
test-examples = ["run", "--manifest-path", "./tools/test-examples/Cargo.toml", "--"]
2+
xtask = ["run", "--manifest-path", "./xtask/Cargo.toml", "--", "xtask"]

.github/workflows/ci.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ jobs:
3838
command: fmt
3939
args: -- --check
4040

41-
- name: '`cargo fmt --manifest-path ./tools/test-examples/Cargo.toml -- --check`'
41+
- name: '`cargo fmt --manifest-path ./xtask/Cargo.toml -- --check`'
4242
uses: actions-rs/cargo@v1
4343
with:
4444
command: fmt
45-
args: --manifest-path ./tools/test-examples/Cargo.toml -- --check
45+
args: --manifest-path ./xtask/Cargo.toml -- --check
4646

4747
build:
4848
strategy:
@@ -118,11 +118,11 @@ jobs:
118118
command: clippy
119119
args: --all-targets --profile test -- -D warnings
120120

121-
- name: '`cargo clippy --manifest-path ./tools/test-examples/Cargo.toml -- -D warnings`'
121+
- name: '`cargo clippy --manifest-path ./xtask/Cargo.toml -- -D warnings`'
122122
uses: actions-rs/cargo@v1
123123
with:
124124
command: clippy
125-
args: --manifest-path ./tools/test-examples/Cargo.toml -- -D warnings
125+
args: --manifest-path ./xtask/Cargo.toml -- -D warnings
126126

127127
- name: '`cargo test --all-targets --no-fail-fast`'
128128
uses: actions-rs/cargo@v1
@@ -136,7 +136,8 @@ jobs:
136136
command: run
137137
args: --release
138138

139-
- name: '`cargo test-examples`'
139+
- name: '`cargo xtask test-examples`'
140140
uses: actions-rs/cargo@v1
141141
with:
142-
command: test-examples
142+
command: xtask
143+
args: test-examples

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/tools/test-examples/Cargo.lock
1+
/xtask/Cargo.lock
22
**/target/
33
**/*.rs.bk
44
**/*~

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ version = "0.1.0"
66
edition = "2018"
77

88
[workspace]
9-
exclude = ["./tools"]
9+
exclude = ["./xtask"]
1010

1111
[[bin]]
1212
name = "main"

tools/test-examples/Cargo.toml renamed to xtask/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "test-examples"
2+
name = "xtask"
33
version = "0.0.0"
44
edition = "2018"
55
publish = false

tools/test-examples/src/main.rs renamed to xtask/src/main.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,18 @@ use std::time::Instant;
2626
use std::{env, f64, fs};
2727

2828
#[derive(StructOpt, Debug)]
29-
struct Opt {
29+
#[structopt(bin_name("cargo"))]
30+
enum Opt {
31+
Xtask(OptXtask),
32+
}
33+
34+
#[derive(StructOpt, Debug)]
35+
enum OptXtask {
36+
TestExamples(OptXtaskTestExamples),
37+
}
38+
39+
#[derive(StructOpt, Debug)]
40+
struct OptXtaskTestExamples {
3041
#[structopt(
3142
long,
3243
value_name("PATH"),
@@ -37,7 +48,7 @@ struct Opt {
3748
}
3849

3950
fn main() -> anyhow::Result<()> {
40-
let Opt { config } = Opt::from_args();
51+
let Opt::Xtask(OptXtask::TestExamples(OptXtaskTestExamples { config })) = Opt::from_args();
4152

4253
env_logger::builder()
4354
.format(|buf, record| {
@@ -60,7 +71,7 @@ fn main() -> anyhow::Result<()> {
6071
write_with_style(Color::Black, false, true, "]")?;
6172
writeln!(buf, " {}", record.args())
6273
})
63-
.filter_module("test_examples", LevelFilter::Info)
74+
.filter_module("xtask", LevelFilter::Info)
6475
.init();
6576

6677
let config = read_toml::<_, Config>(config)?;
@@ -134,7 +145,8 @@ fn scrape_sample_cases(config: &Config) -> anyhow::Result<()> {
134145
}
135146

136147
fn get_html(url: &Url) -> anyhow::Result<Html> {
137-
static USER_AGENT: &str = "test-examples <https://github.com/rust-lang-ja/atcoder-rust-base>";
148+
static USER_AGENT: &str =
149+
"atcoder-rust-base <https://github.com/rust-lang-ja/atcoder-rust-base>";
138150

139151
info!("GET: {}", url);
140152

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy