Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/limatmpl/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ func encodeScriptReason(script string) string {
start := 0
line := 1
for i, r := range script {
if !(unicode.IsPrint(r) || r == '\n' || r == '\r' || r == '\t') {
if !(unicode.IsPrint(r) || r == '\n') {
return fmt.Sprintf("unprintable character %q at offset %d", r, i)
}
// maxLineLength includes final newline
Expand Down
5 changes: 5 additions & 0 deletions pkg/limatmpl/embed_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,11 @@ func TestEncodeScriptReason(t *testing.T) {
reason := encodeScriptReason("abc\a123")
assert.Equal(t, reason, "unprintable character '\\a' at offset 3")
})
t.Run("contains a tab character", func(t *testing.T) {
// newline character is included in character count
reason := encodeScriptReason("foo\tbar")
assert.Equal(t, reason, "unprintable character '\\t' at offset 3")
})
t.Run("long line", func(t *testing.T) {
// newline character is included in character count
reason := encodeScriptReason("line 1\nline 2\n01234567\n")
Expand Down
Loading