Skip to content

Commit 46d1cc3

Browse files
Add tests for --toolchain-version
1 parent ef1d3eb commit 46d1cc3

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/data/script-unstable-feature.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#![feature(lang_items)]
2+
3+
fn main() {
4+
println!("--output--");
5+
println!("`#![feature]` *may* be used!");
6+
}

tests/tests/script.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,3 +179,20 @@ fn test_whitespace_before_main() {
179179
)
180180
.unwrap()
181181
}
182+
183+
#[test]
184+
fn test_stable_toolchain() {
185+
let out = rust_script!("--toolchain-version", "stable", "tests/data/script-unstable-feature.rs").unwrap();
186+
assert!(out.stderr.contains("`#![feature]` may not be used"));
187+
assert!(!out.success());
188+
}
189+
190+
#[test]
191+
fn test_nightly_toolchain() {
192+
let out = rust_script!("--toolchain-version", "nightly", "tests/data/script-unstable-feature.rs").unwrap();
193+
scan!(out.stdout_output();
194+
("`#![feature]` *may* be used!") => ()
195+
)
196+
.unwrap();
197+
assert!(out.success());
198+
}

0 commit comments

Comments
 (0)