Skip to content

Commit

Permalink
Update expandtest
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Oct 12, 2023
1 parent a11b6ed commit 502a1fb
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 50 deletions.
1 change: 0 additions & 1 deletion .github/.cspell/project-dictionary.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
compiletest
expandtest
metavariables
prettyplease
reborrow
wontfix
4 changes: 0 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ updates:
ignore:
# For test on MSRV.
- dependency-name: once_cell
- dependency-name: proc-macro2
- dependency-name: quote
- dependency-name: serde
- dependency-name: toml
- dependency-name: trybuild
labels: []
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@ jobs:
- uses: taiki-e/install-action@cargo-minimal-versions
- uses: taiki-e/install-action@cargo-careful
if: startsWith(matrix.rust, 'nightly')
- uses: taiki-e/cache-cargo-install-action@v1
with:
tool: cargo-expand
if: startsWith(matrix.rust, 'nightly')
- run: cargo test --all --all-features
- run: cargo careful test --all --all-features
env:
Expand Down
9 changes: 1 addition & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,10 @@ members = [
doc-scrape-examples = false

[dev-dependencies]
macrotest = "1.0.9"
macrotest = { git = "https://github.com/taiki-e/macrotest.git", branch = "dev-old-msrv" } # 2021 edition support + lower MSRV + no cargo-expand
rustversion = "1"
static_assertions = "1"
trybuild = "=1.0.67"

# For test on MSRV.
once_cell = "=1.14"
proc-macro2 = "=1.0.65"
quote = "=1.0.30"
serde = "=1.0.156"
toml = "=0.5.9"

[patch.crates-io]
prettyplease = { git = "https://github.com/taiki-e/prettyplease.git", branch = "dev" } # lower MSRV
1 change: 0 additions & 1 deletion tests/expand/pinned_drop/enum.expanded.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::pin::Pin;
use pin_project_lite::pin_project;
enum Enum<T, U> {
Struct { pinned: T, unpinned: U },
Expand Down
2 changes: 0 additions & 2 deletions tests/expand/pinned_drop/enum.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::pin::Pin;

use pin_project_lite::pin_project;

pin_project! {
Expand Down
1 change: 0 additions & 1 deletion tests/expand/pinned_drop/struct.expanded.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use std::pin::Pin;
use pin_project_lite::pin_project;
struct Struct<T, U> {
pinned: T,
Expand Down
2 changes: 0 additions & 2 deletions tests/expand/pinned_drop/struct.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// SPDX-License-Identifier: Apache-2.0 OR MIT

use std::pin::Pin;

use pin_project_lite::pin_project;

pin_project! {
Expand Down
29 changes: 2 additions & 27 deletions tests/expandtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,18 @@
#![cfg(not(careful))]
#![warn(rust_2018_idioms, single_use_lifetimes)]

use std::{
env,
process::{Command, ExitStatus, Stdio},
};
use std::env;

const PATH: &str = "tests/expand/**/*.rs";

#[rustversion::attr(not(nightly), ignore)]
#[test]
fn expandtest() {
let is_ci = env::var_os("CI").is_some();
let cargo = &*env::var("CARGO").unwrap_or_else(|_| "cargo".into());
if !has_command(&[cargo, "expand"]) {
if is_ci {
panic!("expandtest requires cargo-expand");
}
return;
}

let args = &["--all-features"];
if is_ci {
if env::var_os("CI").is_some() {
macrotest::expand_without_refresh_args(PATH, args);
} else {
env::set_var("MACROTEST", "overwrite");
macrotest::expand_args(PATH, args);
}
}

fn has_command(command: &[&str]) -> bool {
Command::new(command[0])
.args(&command[1..])
.arg("--version")
.stdin(Stdio::null())
.stdout(Stdio::null())
.stderr(Stdio::null())
.status()
.as_ref()
.map(ExitStatus::success)
.unwrap_or(false)
}

0 comments on commit 502a1fb

Please sign in to comment.