Skip to content

Commit

Permalink
internal/diff: use new definitions in test
Browse files Browse the repository at this point in the history
Change-Id: Ia211b5124fa31a6a04a57d7418e2351e11bb41a2
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6645
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Jul 23, 2020
1 parent 311f5bc commit 76d8c61
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 27 deletions.
6 changes: 1 addition & 5 deletions internal/diff/diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,7 @@ func label(v cue.Value, i int) string {
if f.IsOptional {
str += "?"
}
if f.IsDefinition {
str += " ::"
} else {
str += ":"
}
str += ":"
return str
}

Expand Down
44 changes: 22 additions & 22 deletions internal/diff/diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -254,38 +254,38 @@ func TestDiff(t *testing.T) {
}, {
name: "optional and definitions",
x: `{
s :: {
a :: 1
#s: {
#a: 1
b: 2
}
o?: 3
od? :: 1
#od?: 1
oc?: 5
}`,
y: `{
s :: {
#s: {
a: 2
b :: 2
#b: 2
}
o?: 4
od :: 1
oc? :: 5
#od: 1
#oc?: 5
}
`,
kind: Modified,
diff: ` {
s :: {
- a :: 1
+ a: 2
#s: {
- #a: 1
- b: 2
+ b :: 2
+ a: 2
+ #b: 2
}
- o?: 3
+ o?: 4
- od? :: 1
+ od :: 1
- #od?: 1
+ #od: 1
- oc?: 5
+ oc? :: 5
+ #oc?: 5
}
`,
}, {
Expand All @@ -306,10 +306,10 @@ a: x: "hello"
`,
}, {
x: `
Directory :: {
#Directory: {
{
// Directory from another directory (e.g. subdirectory)
from: Directory
from: #Directory
} | {
// Reference to remote directory
ref: string
Expand All @@ -321,10 +321,10 @@ a: x: "hello"
}
`,
y: `
Directory :: {
#Directory: {
{
// Directory from another directory (e.g. subdirectory)
from: Directory
from: #Directory
} | {
// Reference to remote directory
ref: string
Expand All @@ -338,10 +338,10 @@ a: x: "hello"
profile: Final,
}, {
x: `
Directory :: {
#Directory: {
{
// Directory from another directory (e.g. subdirectory)
from: Directory
from: #Directory
} | {
// Reference to remote directory
ref: string
Expand All @@ -353,10 +353,10 @@ a: x: "hello"
}
`,
y: `
Directory :: {
#Directory: {
{
// Directory from another directory (e.g. subdirectory)
from: Directory
from: #Directory
} | {
// Reference to remote directory
ref: string
Expand Down

0 comments on commit 76d8c61

Please sign in to comment.