2023-04-06 21:59:09 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestCompile(t *testing.T) {
|
|
|
|
t.Parallel()
|
|
|
|
|
|
|
|
t.Run("With testdata", func(t *testing.T) {
|
|
|
|
ctx := context.Background()
|
|
|
|
|
2023-04-06 22:33:29 +02:00
|
|
|
err := format(ctx, withPath("testdata/test_module"))
|
2023-04-06 21:59:09 +02:00
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
file, err := os.ReadFile("testdata/test_module/very_long_line.go")
|
|
|
|
assert.NoError(t, err)
|
|
|
|
|
|
|
|
assert.Equal(t, string(file), `package testmodule
|
|
|
|
|
|
|
|
func SomeFunction(
|
|
|
|
with, lots, of, parameters, more, more, more, more, more string,
|
|
|
|
) (and string, lots string, of string, someerror string, returns string) {
|
|
|
|
return "", "", "", "", ""
|
|
|
|
}
|
|
|
|
`)
|
|
|
|
})
|
|
|
|
}
|