Skip to content

test-exercise: sed now more precisely excises #[ignore] #396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

coriolinus
Copy link
Member

@coriolinus coriolinus commented Nov 14, 2017

Closes #395.

Previous implementation simply deleted all lines containing the string
[ignore]. This was not desired behavior, because it also deleted
lines which used the attribute inline.

The updated version now removes the string #[ignore] and any
trailing whitespace. If the line is blank in consequence, it deletes
the entire line; otherwise it leaves it.

Given test input:

tests! {
    test_classification {
        #[ignore] test_1(1, Classification::Deficient);
        #[ignore] test_2(2, Classification::Deficient);
        #[ignore] test_4(4, Classification::Deficient);
    }
}

#[test]
#[ignore]
fn test_me() {
   unimplemented!();
}

{
   #[test]
   #[ignore]
   fn test_indented() {
      unimplemented!();
   }
}

#[test] #[ignore] fn test_full_inline() { unimplemented!() }

{
   #[test] #[ignore] fn test_full_inline_indented() { unimplemented!() }
}

// don't [ignore] me
// this might get #[ignore]d

the new sed line produces output:

tests! {
    test_classification {
        test_1(1, Classification::Deficient);
        test_2(2, Classification::Deficient);
        test_4(4, Classification::Deficient);
    }
}

#[test]
fn test_me() {
   unimplemented!();
}

{
   #[test]
   fn test_indented() {
      unimplemented!();
   }
}

#[test] fn test_full_inline() { unimplemented!() }

{
   #[test] fn test_full_inline_indented() { unimplemented!() }
}

// don't [ignore] me
// this might get d

If this is approved, it should be merged before #394 so that one can use the attribute inline.

Previous implementation simply deleted all lines containing the string
`[ignore]`. This was not desired behavior, because it also deleted
lines which used the attribute inline.

The updated version now removes the string `#[ignore]` and any
trailing whitespace. If the line is blank in consequence, it deletes
the entire line; otherwise it leaves it.
@coriolinus coriolinus changed the title Improve test-exercise: sed now more precisely excises #[ignore] lines test-exercise: sed now more precisely excises #[ignore] Nov 14, 2017
@coriolinus
Copy link
Member Author

Given no objections in 5 days, I'm going to merge this now.

@coriolinus coriolinus merged commit 5d9cc23 into exercism:master Nov 19, 2017
@coriolinus coriolinus deleted the improve-test-exercise-sed-excise-ignore branch November 19, 2017 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant