Skip to content

test-exercise script cuts out all lines which contain #[ignore] #395

Closed
@coriolinus

Description

@coriolinus

Every line containing #[ignore] gets cut out entirely. This isn't desired behavior,
because it prohibits inline use of the attribute. In particular, the following (from #394):

tests! {
    test_classification {
        #[ignore] test_1(1, Classification::Deficient);
        #[ignore] test_2(2, Classification::Deficient);
        #[ignore] test_4(4, Classification::Deficient);
        #[ignore] test_6(6, Classification::Perfect);
        #[ignore] test_12(12, Classification::Abundant);
        #[ignore] test_28(28, Classification::Perfect);
        #[ignore] test_30(30, Classification::Abundant);
        #[ignore] test_32(32, Classification::Deficient);
        #[ignore] test_33550335(33550335, Classification::Abundant);
        #[ignore] test_33550336(33550336, Classification::Perfect);
        #[ignore] test_33550337(33550337, Classification::Deficient);
    }
}

gets trimmed down to:

tests! {
    test_classification {
    }
}

instead of the desired:

tests! {
    test_classification {
        test_1(1, Classification::Deficient);
        test_2(2, Classification::Deficient);
        test_4(4, Classification::Deficient);
        test_6(6, Classification::Perfect);
        test_12(12, Classification::Abundant);
        test_28(28, Classification::Perfect);
        test_30(30, Classification::Abundant);
        test_32(32, Classification::Deficient);
        test_33550335(33550335, Classification::Abundant);
        test_33550336(33550336, Classification::Perfect);
        test_33550337(33550337, Classification::Deficient);
    }
}

We have to fix this using the uglier pattern:

tests! {
    test_classification {
        #[ignore]
        test_1(1, Classification::Deficient);
        #[ignore]
        test_2(2, Classification::Deficient);
        #[ignore]
        test_4(4, Classification::Deficient);
        #[ignore]
        test_6(6, Classification::Perfect);
        #[ignore]
        test_12(12, Classification::Abundant);
        #[ignore]
        test_28(28, Classification::Perfect);
        #[ignore]
        test_30(30, Classification::Abundant);
        #[ignore]
        test_32(32, Classification::Deficient);
        #[ignore]
        test_33550335(33550335, Classification::Abundant);
        #[ignore]
        test_33550336(33550336, Classification::Perfect);
        #[ignore]
        test_33550337(33550337, Classification::Deficient);
    }
}

Desired behavior: this sed line removes only the text #[ignore] when encountered in the relevant files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions