Skip to content

Commit

Permalink
Fix tests for rustc 1.56
Browse files Browse the repository at this point in the history
  • Loading branch information
Kijewski authored and utkarshkukreti committed Nov 16, 2023
1 parent 36f9e65 commit 82a608b
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 3 deletions.
1 change: 1 addition & 0 deletions ui-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ publish = false

[dependencies]
markup = { path = "../markup" }
rustc_version = "0.4.0"
trybuild = "1.0.85"
File renamed without changes.
25 changes: 25 additions & 0 deletions ui-tests/fail-1.56/not-render.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
error[E0277]: the trait bound `NotRender: RenderAttributeValue` is not satisfied
--> fail-1.56/not-render.rs:6:26
|
6 | html["attr-user"=name] {
| ^^^^ the trait `RenderAttributeValue` is not implemented for `NotRender`
|
= note: required because of the requirements on the impl of `RenderAttributeValue` for `&NotRender`
note: required by `is_none`
--> $WORKSPACE/markup/src/lib.rs
|
| fn is_none(&self) -> bool {
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `NotRender: Render` is not satisfied
--> fail-1.56/not-render.rs:8:36
|
8 | strong { "Hello " @name "!" }
| ^^^^ the trait `Render` is not implemented for `NotRender`
|
= note: required because of the requirements on the impl of `Render` for `&NotRender`
note: required by a bound in `render`
--> $WORKSPACE/markup/src/lib.rs
|
| fn render(&self, writer: &mut impl std::fmt::Write) -> std::fmt::Result;
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `render`
16 changes: 16 additions & 0 deletions ui-tests/fail-1.72/not-render.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
struct NotRender;

markup::define! {
Layout(name: NotRender) {
@markup::doctype()
html["attr-user"=name] {
body {
strong { "Hello " @name "!" }
}
}
}
}

fn main() {

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0277]: the trait bound `NotRender: RenderAttributeValue` is not satisfied
--> fail/not-render.rs:6:26
--> fail-1.72/not-render.rs:6:26
|
6 | html["attr-user"=name] {
| ^^^^ the trait `RenderAttributeValue` is not implemented for `NotRender`
Expand All @@ -17,7 +17,7 @@ error[E0277]: the trait bound `NotRender: RenderAttributeValue` is not satisfied
= note: required for `&NotRender` to implement `RenderAttributeValue`

error[E0277]: the trait bound `NotRender: Render` is not satisfied
--> fail/not-render.rs:8:36
--> fail-1.72/not-render.rs:8:36
|
8 | strong { "Hello " @name "!" }
| ^^^^ the trait `Render` is not implemented for `NotRender`
Expand Down
9 changes: 8 additions & 1 deletion ui-tests/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#[test]
fn ui() {
let version = rustc_version::version().unwrap();
assert_eq!(version.major, 1);

let fail = trybuild::TestCases::new();
fail.compile_fail("fail/*.rs");
if version.minor <= 56 {
fail.compile_fail("fail-1.56/*.rs");
} else {
fail.compile_fail("fail-1.72/*.rs");
}
}

0 comments on commit 82a608b

Please sign in to comment.