Skip to content

Tests generated from macros lead to funky CodeLens in VS Code #10744

@matthew-e-brown

Description

@matthew-e-brown

When working on old Advent of Code problems, I was writing up the examples as test cases. To be DRY, I decided to use the test-case crate:

    #[test_case("(())",      0 ; "case 1")]
    #[test_case("()()",      0 ; "case 2")]
    #[test_case("(((",       3 ; "case 3")]
    #[test_case("(((",       3 ; "case 4")]
    #[test_case("))(((((",   3 ; "case 5")]
    #[test_case("())",      -1 ; "case 6")]
    #[test_case("))(",      -1 ; "case 7")]
    #[test_case(")))",      -3 ; "case 8")]
    #[test_case(")())())",  -3 ; "case 9")]
    fn example(str_sequence: &str, result: i32) {
        let sequence = directions_from_string(str_sequence).unwrap();
        assert_eq!(run_1(&sequence), result);
    }

Unfortunately, it leads to some pretty unsightly results in the CodeLens:

All of the 'Run fn_name Tests | Debug' options are strung together and not separated, and fly way off the side of the page. If I wanted to use one of them, it would be near impossible to find which of the chunks I'm supposed to click on for which test. I'm not sure if this is more to do with Rust Analyzer or VS Code itself, but since an issue here will get more eyes than one in the VSC repo, it's probably best to start here—if this is not the right place for this issue, please direct me to the right place! Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-idegeneral IDE featuresC-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions