Skip to content

Commit

Permalink
fix doc generate command unit test on windows os
Browse files Browse the repository at this point in the history
  • Loading branch information
amyXia1994 committed Aug 2, 2023
1 parent 7a911fc commit dbf9e8f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/tools/doc/doc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package doc
import (
"github.com/stretchr/testify/assert"
kcl "kcl-lang.io/kcl-go"
"runtime"
"strings"
"testing"
)

Expand Down Expand Up @@ -53,6 +55,10 @@ todo: The example section
if err != nil {
t.Errorf("render failed, err: %s", err)
}
assert.Equal(t, tcase.expect, string(content), "render content mismatch")
expect := tcase.expect
if runtime.GOOS == "windows" {
expect = strings.ReplaceAll(tcase.expect, "\n", "\r\n")
}
assert.Equal(t, expect, string(content), "render content mismatch")
}
}

0 comments on commit dbf9e8f

Please sign in to comment.