Skip to content

Commit b719859

Browse files
authored
Merge pull request #104 from pbrkr/for-upstream
Mark tests which need internet access
2 parents c6317a8 + aca514d commit b719859

File tree

4 files changed

+17
-1
lines changed

4 files changed

+17
-1
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
with:
2121
toolchain: ${{ matrix.rust }}
2222
- name: Run unit tests
23-
run: rustc --version && cargo --version && cargo test
23+
run: rustc --version && cargo --version && cargo test --features online_tests
2424
- name: Run script tests
2525
if: runner.os != 'Windows'
2626
run: |

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,7 @@ scan-rules = "0.2"
4343

4444
[profile.release]
4545
lto = true
46+
47+
[features]
48+
default=[]
49+
online_tests=[]

tests/tests/expr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ fn test_expr_temporary() {
2828
assert!(out.success());
2929
}
3030

31+
#[cfg_attr(not(feature = "online_tests"), ignore)]
3132
#[test]
3233
fn test_expr_dep() {
3334
let out = rust_script!(

tests/tests/script.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#[cfg_attr(not(feature = "online_tests"), ignore)]
12
#[test]
23
fn test_script_explicit() {
34
let out = rust_script!("-d", "boolinator", "tests/data/script-explicit.rs").unwrap();
@@ -7,6 +8,7 @@ fn test_script_explicit() {
78
.unwrap()
89
}
910

11+
#[cfg_attr(not(feature = "online_tests"), ignore)]
1012
#[test]
1113
fn test_script_full_block() {
1214
let out = rust_script!("tests/data/script-full-block.rs").unwrap();
@@ -16,6 +18,7 @@ fn test_script_full_block() {
1618
.unwrap()
1719
}
1820

21+
#[cfg_attr(not(feature = "online_tests"), ignore)]
1922
#[test]
2023
fn test_script_full_line() {
2124
let out = rust_script!("tests/data/script-full-line.rs").unwrap();
@@ -25,6 +28,7 @@ fn test_script_full_line() {
2528
.unwrap()
2629
}
2730

31+
#[cfg_attr(not(feature = "online_tests"), ignore)]
2832
#[test]
2933
fn test_script_full_line_without_main() {
3034
let out = rust_script!("tests/data/script-full-line-without-main.rs").unwrap();
@@ -61,6 +65,7 @@ fn test_script_no_deps() {
6165
.unwrap()
6266
}
6367

68+
#[cfg_attr(not(feature = "online_tests"), ignore)]
6469
#[test]
6570
fn test_script_short() {
6671
let out = rust_script!("tests/data/script-short.rs").unwrap();
@@ -70,6 +75,7 @@ fn test_script_short() {
7075
.unwrap()
7176
}
7277

78+
#[cfg_attr(not(feature = "online_tests"), ignore)]
7379
#[test]
7480
fn test_script_short_without_main() {
7581
let out = rust_script!("tests/data/script-short-without-main.rs").unwrap();
@@ -133,6 +139,7 @@ fn test_script_including_relative() {
133139
.unwrap()
134140
}
135141

142+
#[cfg_attr(not(feature = "online_tests"), ignore)]
136143
#[test]
137144
fn script_with_same_name_as_dependency() {
138145
let out = rust_script!("tests/data/time.rs").unwrap();
@@ -150,6 +157,7 @@ fn script_without_main_question_mark() {
150157
.starts_with("Error: Os { code: 2, kind: NotFound, message:"));
151158
}
152159

160+
#[cfg_attr(not(feature = "online_tests"), ignore)]
153161
#[test]
154162
fn test_script_async_main() {
155163
let out = rust_script!("tests/data/script-async-main.rs").unwrap();
@@ -159,6 +167,7 @@ fn test_script_async_main() {
159167
.unwrap()
160168
}
161169

170+
#[cfg_attr(not(feature = "online_tests"), ignore)]
162171
#[test]
163172
fn test_pub_fn_main() {
164173
let out = rust_script!("tests/data/pub-fn-main.rs").unwrap();
@@ -177,6 +186,7 @@ fn test_cargo_target_dir_env() {
177186
.unwrap()
178187
}
179188

189+
#[cfg_attr(not(feature = "online_tests"), ignore)]
180190
#[test]
181191
fn test_outer_line_doc() {
182192
let out = rust_script!("tests/data/outer-line-doc.rs").unwrap();
@@ -262,6 +272,7 @@ fn test_same_flags() {
262272
}
263273

264274
#[cfg(unix)]
275+
#[cfg_attr(not(feature = "online_tests"), ignore)]
265276
#[test]
266277
fn test_extern_c_main() {
267278
let out = rust_script!("tests/data/extern-c-main.rs").unwrap();

0 commit comments

Comments
 (0)