Skip to content

Commit

Permalink
Test RUSTC_FORCE_RUSTC_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Apr 25, 2024
1 parent e936289 commit 3c75940
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/ui/feature-gates/version_check.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
//@ run-pass
use std::process::Command;

fn main() {
let signalled_version = "Ceci n'est pas une rustc";
let version = Command::new(std::env::var_os("RUSTC").unwrap())
.env("RUSTC_FORCE_RUSTC_VERSION", signalled_version)
.arg("--version")
.output()
.unwrap()
.stdout;
let version = String::from_utf8(version).unwrap();
assert_ne!(version, signalled_version);
let version = Command::new(std::env::var_os("RUSTC").unwrap())
.env("RUSTC_FORCE_RUSTC_VERSION", signalled_version)
.arg("--version")
.arg("--verbose")
.output()
.unwrap()
.stdout;
let version = String::from_utf8(version).unwrap();
assert_ne!(version, signalled_version);
}

0 comments on commit 3c75940

Please sign in to comment.