exercism / go-test-runner

GNU Affero General Public License v3.0
15 stars 17 forks source link

Redundant empty line in extracted test code #79

Closed junedev closed 1 year ago

junedev commented 2 years ago

If the extraction of the individual test from a list of test cases worked out, the result has a redundant empty line after the struct definition part: image

eklatzer commented 2 years ago

Hey, I checked out the code of the test runner a bit. I could not fix the problem. What I noticed is, that there is no empty line, if the test cases are formatted like this (opening { one line higher):

tests := []struct {
        name           string
        productionRate int
        successRate    float64
        want           float64
    }{{
            name:           "calculate working cars per hour for production rate 0",
            productionRate: 0,
            successRate:    100,
            want:           0.0,
        },
[...]

I tried different things in ast.go, especially in func getSubCode (mostly lhs1 and rhs1)

Maybe these notes help in the future

bdsbinhthuan commented 2 years ago

hmm