Skip to content

Commit 9bd233e

Browse files
committed
Add unit tests
1 parent c8ceaf6 commit 9bd233e

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

cli_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package dartfmt_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/go-generalize/go-dartfmt"
7+
)
8+
9+
func TestFormatDartWithDartCLI(t *testing.T) {
10+
runFormat(t, dartfmt.FormatDartWithDartCLI, "testdata/001")
11+
}
12+
13+
func TestFormatDartWithDartfmtCLI(t *testing.T) {
14+
runFormat(t, dartfmt.FormatDartWithDartfmtCLI, "testdata/001")
15+
}
16+
17+
func TestFormatDartWithFlutterCLI(t *testing.T) {
18+
runFormat(t, dartfmt.FormatDartWithFlutterCLI, "testdata/001")
19+
}

dartfmt_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func runFormat(t *testing.T, formatter dartfmt.Formatter, dir string) {
2525
}
2626
expected := string(expectedBytes)
2727

28-
actual, err := dartfmt.FormatDart(string(input))
28+
actual, err := formatter(string(input))
2929

3030
if err != nil {
3131
t.Fatal(err)

goja_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package dartfmt_test
2+
3+
import (
4+
"testing"
5+
6+
"github.com/go-generalize/go-dartfmt"
7+
)
8+
9+
func TestFormatDartStandalone(t *testing.T) {
10+
runFormat(t, dartfmt.FormatDartStandalone, "testdata/001")
11+
}

0 commit comments

Comments
 (0)