nushell / nufmt

MIT License
64 stars 8 forks source link

`format_inner` does not remove all trailing newlines #34

Closed amtoine closed 8 months ago

amtoine commented 1 year ago

Later we would need to fix the failing test, but nonetheless is a step forward! I'm allright with a merge right now 😄

Originally posted by @AucaCoyan in https://github.com/nushell/nufmt/issues/31#issuecomment-1602741114

the test here is the following

    #[test]
    fn remove_additional_lines() {
        let input = "let one = 1\n\n\n";
        let expected = "let one = 1\n";
        run_test(input, expected);
    }

i think it should become

    #[test]
    fn remove_additional_lines() {
        let input = "let one = 1\n\n\n";
        let expected = "let one = 1";
        run_test(input, expected);
    }

Note the is no more newlines at the end of expected => this was moved out of the responsibility of format_inner in #31.

AucaCoyan commented 8 months ago

The PR #35 solves this issue 🎉