mirror of
https://github.com/google/go-jsonnet.git
synced 2025-09-29 09:21:03 +02:00
Post-rebase fix
Dead code removed in one branch, ended up being used in another.
This commit is contained in:
parent
4b0735826d
commit
171cdd67f9
20
main_test.go
20
main_test.go
@ -23,6 +23,7 @@ import (
|
|||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
"unicode/utf8"
|
||||||
|
|
||||||
"github.com/sergi/go-diff/diffmatchpatch"
|
"github.com/sergi/go-diff/diffmatchpatch"
|
||||||
)
|
)
|
||||||
@ -196,6 +197,25 @@ func TestMinimalError(t *testing.T) {
|
|||||||
// TODO(sbarzowski) test pretty errors once they are stable-ish
|
// TODO(sbarzowski) test pretty errors once they are stable-ish
|
||||||
// probably "golden" pattern is the right one for that
|
// probably "golden" pattern is the right one for that
|
||||||
|
|
||||||
|
func removeExcessiveWhitespace(s string) string {
|
||||||
|
var buf bytes.Buffer
|
||||||
|
separated := true
|
||||||
|
for i, w := 0, 0; i < len(s); i += w {
|
||||||
|
runeValue, width := utf8.DecodeRuneInString(s[i:])
|
||||||
|
if runeValue == '\n' || runeValue == ' ' {
|
||||||
|
if !separated {
|
||||||
|
buf.WriteString(" ")
|
||||||
|
separated = true
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
buf.WriteRune(runeValue)
|
||||||
|
separated = false
|
||||||
|
}
|
||||||
|
w = width
|
||||||
|
}
|
||||||
|
return buf.String()
|
||||||
|
}
|
||||||
|
|
||||||
func TestCustomImporter(t *testing.T) {
|
func TestCustomImporter(t *testing.T) {
|
||||||
vm := MakeVM()
|
vm := MakeVM()
|
||||||
vm.Importer(&MemoryImporter{
|
vm.Importer(&MemoryImporter{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user