Skip to content

Commit a15c3f6

Browse files
committed
Attempt at trybuild test
1 parent ed409e7 commit a15c3f6

File tree

6 files changed

+80
-2
lines changed

6 files changed

+80
-2
lines changed

tests/Cargo.lock

Lines changed: 62 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ edition = "2021"
99
reqwest = "0.11.18"
1010
watto = { git = "https://github.com/getsentry/watto", rev = "d71c8218506bddba102a124a460d64da25e303dc", features = ["strings"] }
1111

12+
[dev-dependencies]
13+
trybuild = "1"
14+
1215
[target.'cfg(not(target_env = "msvc"))'.dependencies]
1316
tikv-jemallocator = "0.5.4"

tests/tests/trybuild.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#[test]
2+
fn test_trybuild() {
3+
let t = trybuild::TestCases::new();
4+
t.pass("tests/trybuild/empty_main.rs");
5+
t.compile_fail("tests/trybuild/fail_to_compile.rs");
6+
}

tests/tests/trybuild/empty_main.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fn main() {}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
"foobar".foobar();
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
error[E0599]: no method named `foobar` found for reference `&'static str` in the current scope
2+
--> tests/trybuild/fail_to_compile.rs:2:14
3+
|
4+
2 | "foobar".foobar();
5+
| ^^^^^^ method not found in `&str`

0 commit comments

Comments
 (0)