Stream: general

Topic: UI tests woes


Kornel (Apr 19 2020 at 13:11, on Zulip):

I'm trying to add a help line to an existing error message, and I'm running into issues:

Kornel (Apr 19 2020 at 13:11, on Zulip):
unexpected errors (from JSON output): [
    Error {
        line_num: 3,
        kind: Some(
            Help,
        ),
        msg: "3:1: 3:21: if there is `mod not_a_real_file` elsewhere in the crate already, import it with `use crate::` instead",
    },
]

not found errors (from test file): [
    Error {
        line_num: 4,
        kind: Some(
            Help,
        ),
        msg: "if there is `mod not_a_real_file` elsewhere in the crate already",
    },
]

thread '[ui] ui/parser/mod_file_not_exist.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1460:13
Kornel (Apr 19 2020 at 13:12, on Zulip):

and the file is:

// ignore-windows

mod not_a_real_file; //~ ERROR file not found for module `not_a_real_file`
//~^ HELP to create the module `not_a_real_file` here, create file
//~^ HELP if there is `mod not_a_real_file` elsewhere in the crate already

fn main() {
    assert_eq!(mod_file_aux::bar(), 10);
    //~^ ERROR failed to resolve: use of undeclared type or module `mod_file_aux`
}
Jonas Schievink (Apr 19 2020 at 13:12, on Zulip):

the second //~^ HELP needs to be //~| HELP

Kornel (Apr 19 2020 at 13:12, on Zulip):

Can I have two //~^ HELP lines per error? Are they searching for a substring, or do they have to be an exact match?

Jonas Schievink (Apr 19 2020 at 13:13, on Zulip):

^ means "should appear on the line above this one"

Jonas Schievink (Apr 19 2020 at 13:13, on Zulip):

| means "should appear on the same line as the above pattern"

Kornel (Apr 19 2020 at 13:13, on Zulip):

Thanks

RalfJ (Apr 19 2020 at 13:44, on Zulip):

also see https://rustc-dev-guide.rust-lang.org/tests/adding.html#error-annotations

lqd (Apr 19 2020 at 14:15, on Zulip):

there's also // ignore-tidy-linelength

Vadim Petrochenkov (Apr 19 2020 at 21:46, on Zulip):

lqd said:

there's also // ignore-tidy-linelength

which should almost never be used in UI tests

Last update: May 29 2020 at 18:05UTC