Skip to content

Commit

Permalink
internal/core/export: fix bytes printing bug
Browse files Browse the repository at this point in the history
Change-Id: If8c7e78805c5f21b188cf28bc4c58d12b67842c0
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/7847
Reviewed-by: CUE cueckoo <cueckoo@gmail.com>
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Dec 2, 2020
1 parent 64434c4 commit 039fb59
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions internal/core/export/testdata/adt.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ d2: C="foo\(bar)": {
foo: C.name
}

bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'

c1: mystrings.Contains("aa", "a")

s1: """
Expand Down Expand Up @@ -95,8 +97,9 @@ d2: {
foo: C.name
}
}
c1: mystrings.Contains("aa", "a")
s1: """
bytes: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)'
c1: mystrings.Contains("aa", "a")
s1: """
multi
\(bar)
line
Expand Down Expand Up @@ -153,6 +156,7 @@ y1: {
[d2 foobar]
[d2 foobar name]
[d2 foobar foo]
[bytes]
[c1]
[s1]
[l1]
Expand Down
2 changes: 1 addition & 1 deletion internal/core/export/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (e *exporter) bytes(n *adt.Bytes, orig []adt.Conjunct) *ast.BasicLit {
if b := extractBasic(orig); b != nil {
return b
}
s := literal.String.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
s := literal.Bytes.WithOptionalTabIndent(len(e.stack)).Quote(string(n.B))
return &ast.BasicLit{
Kind: token.STRING,
Value: s,
Expand Down

0 comments on commit 039fb59

Please sign in to comment.