From d60f48da69ac06865f5396b146de8cbc2f03e485 Mon Sep 17 00:00:00 2001 From: Kevin Flansburg Date: Mon, 27 Sep 2021 17:20:20 -0400 Subject: [PATCH] Fix UI tests (#51) Signed-off-by: Kevin Flansburg --- .github/workflows/build.yml | 2 +- Cargo.lock | 5 ++--- krator/Cargo.toml | 2 +- krator/tests/ui.rs | 1 + .../ui/state/cannot_construct_transition_next.stderr | 2 +- krator/tests/ui/state/next_must_be_state.stderr | 10 ++++++++-- krator/tests/ui/state/require_same_object_state.stderr | 10 ++++++++-- krator/tests/ui/state/require_transition_to.stderr | 10 ++++++++-- 8 files changed, 30 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f75161f..28bea0c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: - name: Install toolchain stable uses: actions-rs/toolchain@v1 with: - toolchain: stable + toolchain: nightly default: true - name: UI Test with toolchain stable uses: actions-rs/cargo@v1 diff --git a/Cargo.lock b/Cargo.lock index c072ad7..9fee8b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -200,9 +200,8 @@ dependencies = [ [[package]] name = "compiletest_rs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0086d6ad78cf409c3061618cd98e2789d5c9ce598fc9651611cf62eae0a599cb" +version = "0.7.0" +source = "git+https://github.com/kflansburg/compiletest-rs.git#1fed0133bef7066447622840f66c257e0502f436" dependencies = [ "diff", "filetime", diff --git a/krator/Cargo.toml b/krator/Cargo.toml index 59d13ab..4a78d37 100644 --- a/krator/Cargo.toml +++ b/krator/Cargo.toml @@ -68,7 +68,7 @@ tokio = { version = "1.0", features = ["fs", "macros", "signal", "rt-multi-threa opentelemetry-jaeger = "0.11" tracing-opentelemetry = "0.11" structopt = "0.3" -compiletest_rs = "0.6" +compiletest_rs = { version = "0.7", git = "https://github.com/kflansburg/compiletest-rs.git" } [[example]] name = "moose" diff --git a/krator/tests/ui.rs b/krator/tests/ui.rs index 1e030ee..4f4591d 100644 --- a/krator/tests/ui.rs +++ b/krator/tests/ui.rs @@ -22,6 +22,7 @@ fn compile_test() { let mut config = compiletest_rs::Config { mode: compiletest_rs::common::Mode::Ui, src_base: PathBuf::from("tests/ui"), + target_rustcflags: Some(" -Z ui-testing ".to_string()), ..Default::default() }; link_deps(&mut config); diff --git a/krator/tests/ui/state/cannot_construct_transition_next.stderr b/krator/tests/ui/state/cannot_construct_transition_next.stderr index c0fb766..aa95746 100644 --- a/krator/tests/ui/state/cannot_construct_transition_next.stderr +++ b/krator/tests/ui/state/cannot_construct_transition_next.stderr @@ -1,7 +1,7 @@ error[E0451]: field `state` of struct `StateHolder` is private --> $DIR/cannot_construct_transition_next.rs:26:9 | -26 | state: Box::new(Stub), +LL | state: Box::new(Stub), | ^^^^^^^^^^^^^^^^^^^^^ private field error: aborting due to previous error diff --git a/krator/tests/ui/state/next_must_be_state.stderr b/krator/tests/ui/state/next_must_be_state.stderr index 9c1253f..250d4a6 100644 --- a/krator/tests/ui/state/next_must_be_state.stderr +++ b/krator/tests/ui/state/next_must_be_state.stderr @@ -1,10 +1,16 @@ error[E0277]: the trait bound `NotState: krator::State` is not satisfied --> $DIR/next_must_be_state.rs:39:9 | -39 | Transition::next(self, NotState) +LL | Transition::next(self, NotState) | ^^^^^^^^^^^^^^^^ the trait `krator::State` is not implemented for `NotState` | - = note: required by `Transition::::next` +note: required by `Transition::::next` + --> $SRC_DIR/src/state.rs:43:5 + | +LL | / pub fn next, O: State>(_i: Box, o: O) -> Transition +LL | | where +LL | | I: TransitionTo, + | |___________________________^ error: aborting due to previous error diff --git a/krator/tests/ui/state/require_same_object_state.stderr b/krator/tests/ui/state/require_same_object_state.stderr index b3bb0db..3394f6f 100644 --- a/krator/tests/ui/state/require_same_object_state.stderr +++ b/krator/tests/ui/state/require_same_object_state.stderr @@ -1,12 +1,18 @@ error[E0277]: the trait bound `OtherState: krator::State` is not satisfied --> $DIR/require_same_object_state.rs:50:9 | -50 | Transition::next(self, OtherState) +LL | Transition::next(self, OtherState) | ^^^^^^^^^^^^^^^^ the trait `krator::State` is not implemented for `OtherState` | = help: the following implementations were found: > - = note: required by `Transition::::next` +note: required by `Transition::::next` + --> $SRC_DIR/src/state.rs:43:5 + | +LL | / pub fn next, O: State>(_i: Box, o: O) -> Transition +LL | | where +LL | | I: TransitionTo, + | |___________________________^ error: aborting due to previous error diff --git a/krator/tests/ui/state/require_transition_to.stderr b/krator/tests/ui/state/require_transition_to.stderr index 31ffad1..ad09a88 100644 --- a/krator/tests/ui/state/require_transition_to.stderr +++ b/krator/tests/ui/state/require_transition_to.stderr @@ -1,10 +1,16 @@ error[E0277]: the trait bound `TestState: TransitionTo<_>` is not satisfied --> $DIR/require_transition_to.rs:38:9 | -38 | Transition::next(self, TestState) +LL | Transition::next(self, TestState) | ^^^^^^^^^^^^^^^^ the trait `TransitionTo<_>` is not implemented for `TestState` | - = note: required by `Transition::::next` +note: required by `Transition::::next` + --> $SRC_DIR/src/state.rs:43:5 + | +LL | / pub fn next, O: State>(_i: Box, o: O) -> Transition +LL | | where +LL | | I: TransitionTo, + | |___________________________^ error: aborting due to previous error