Skip to content

Commit

Permalink
trybuild test of compile fail from README
Browse files Browse the repository at this point in the history
This has the same error in it twice, and I'm not sure why. Unsatisfying,
but better to test the status quo and hopefully iterate than do nothing.
  • Loading branch information
scottlamb committed Oct 23, 2022
1 parent 01892c2 commit acce396
Show file tree
Hide file tree
Showing 5 changed files with 144 additions and 9 deletions.
95 changes: 86 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions static-xml-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ syn = "1.0"

[lib]
proc-macro = true

[dev-dependencies]
trybuild = "1.0.71"
5 changes: 5 additions & 0 deletions static-xml-derive/tests/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#[test]
fn test() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/ui/field-not-parsetext.rs");
}
10 changes: 10 additions & 0 deletions static-xml-derive/tests/ui/field-not-parsetext.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use static_xml_derive::Deserialize;

struct Foo;

#[derive(Deserialize)]
struct Outer {
foo: Foo,
}

fn main() {}
40 changes: 40 additions & 0 deletions static-xml-derive/tests/ui/field-not-parsetext.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
error[E0277]: the trait bound `Foo: ParseText` is not satisfied
--> tests/ui/field-not-parsetext.rs:7:5
|
5 | #[derive(Deserialize)]
| ----------- this tail expression is of type `&mut Foo`
6 | struct Outer {
7 | foo: Foo,
| ^^^^^^^^ the trait `ParseText` is not implemented for `Foo`
|
= help: the following other types implement trait `ParseText`:
String
bool
f32
f64
i128
i16
i32
i64
and $N others
= note: required for `Foo` to implement `Deserialize`
= note: required for `Foo` to implement `DeserializeElementField`

error[E0277]: the trait bound `Foo: ParseText` is not satisfied
--> tests/ui/field-not-parsetext.rs:7:5
|
7 | foo: Foo,
| ^^^^^^^^ the trait `ParseText` is not implemented for `Foo`
|
= help: the following other types implement trait `ParseText`:
String
bool
f32
f64
i128
i16
i32
i64
and $N others
= note: required for `Foo` to implement `Deserialize`
= note: required for `Foo` to implement `DeserializeElementField`

0 comments on commit acce396

Please sign in to comment.