Skip to content
This repository has been archived by the owner on Nov 18, 2021. It is now read-only.

Commit

Permalink
all: update most tests to not use ::
Browse files Browse the repository at this point in the history
Change-Id: I0356417bab7b68b1f6bd8c540902fc049f078cd8
Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6200
Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
  • Loading branch information
mpvl committed Jun 2, 2020
1 parent 3e62450 commit 083afe7
Show file tree
Hide file tree
Showing 33 changed files with 454 additions and 466 deletions.
6 changes: 3 additions & 3 deletions cmd/cue/cmd/testdata/script/cmd_dep.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
)

foo: {
a :: string
b: a
#a: string
b: #a
}

command: do: {
Expand All @@ -25,7 +25,7 @@ command: do: {
}
outputs: print: cli.Print & {
text: json.Marshal(foo & {
a :: strings.TrimSpace(inputs.name.stdout)
#a: strings.TrimSpace(inputs.name.stdout)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/cmd_echo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ stdout 'Hello World!'
-- data.cue --
package hello

who :: "World"
_who: "World"
-- hello.cue --
package hello

message: "Hello \(who)!" // who declared in data.cue
message: "Hello \(_who)!" // who declared in data.cue
-- hello_tool.cue --
package hello

Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/cmd_print.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ command: print: {
stdout: string
}
print: cli.Print & {
text: (f & {arg: runs.t1.stdout + runs.t2.stdout}).result
text: (#f & {arg: runs.t1.stdout + runs.t2.stdout}).result
}
}

f :: {
#f: {
arg: string
result: strings.Join(strings.Split(arg, ""), ".")
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/cmd_run.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: "Hello world!"
-- task_tool.cue --
package home

command: run: RunBase & {
command: run: #RunBase & {
task: echo: cmd: "echo \(message)"
}

Expand All @@ -22,7 +22,7 @@ import (

// deliberately put in another file to test resolving top-level identifiers
// in different files.
RunBase :: {
#RunBase: {
task: echo: exec.Run & {
stdout: string
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/def_basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cmp stdout expect-stdout2
// foo
package foo

A :: {
#A: {
// a is an integer
a: int
b: { c: int } // TODO: should we _not_ simplify?
Expand All @@ -22,7 +22,7 @@ A :: {
// foo
package foo

A :: {
#A: {
// a is an integer
a: int
b: c: int
Expand Down
6 changes: 3 additions & 3 deletions cmd/cue/cmd/testdata/script/def_openapi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ cmp stdout expect-cue3

$version: "v1"

Foo :: {
#Foo: {
a: int
b: uint & <10
}

Bar :: {
foo: Foo
#Bar: {
foo: #Foo
}

-- openapi.json --
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/eval_concrete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ Hello World!
-- data.cue --
package hello

who :: "World"
#who: "World"
-- hello.cue --
package hello

message: "Hello \(who)!" // who declared in data.cue
message: "Hello \(#who)!" // who declared in data.cue
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/eval_import.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ cmp stdout expect-stdout
import "list"

def: {
types :: list.MinItems(1)
#types: list.MinItems(1)
}
-- in.cue --
import (
"list"
)

def: types :: list.MinItems(1)
def: #types: list.MinItems(1)

4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/export.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ cmp stdout expect-stdout
-- hello/data.cue --
package hello

who :: "World"
#who: "World"
-- hello/hello.cue --
package hello

$type: "demo"
message: "Hello \(who)!" // who declared in data.cue
message: "Hello \(#who)!" // who declared in data.cue
-- hello/cue.mod --
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/export_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ test: {}
-- hello/data.cue --
package hello

who :: "World"
_who: "World"
-- hello/hello.cue --
package hello

message: "Hello \(who)!" // who declared in data.cue
message: "Hello \(_who)!" // who declared in data.cue

test: {
_foo: string // technically in error, but test anyway.
Expand Down
2 changes: 1 addition & 1 deletion cmd/cue/cmd/testdata/script/help_doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cmp stdout-foo foo
package bar

name: "foo"
D :: int
_D: int

-- bar.cue --
3
Expand Down
18 changes: 9 additions & 9 deletions cmd/cue/cmd/testdata/script/issue217.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ cmp stdout def-stdout
package tst

x: {
a: A
b: A
a: #A
b: #A
}

A :: string | [A]
#A: string | [#A]

-- def-stdout --
package tst

x: {
a: A
b: A
a: #A
b: #A
}
A :: string | [A]
#A: string | [#A]
-- eval-stdout --
x: {
a: A
b: A
a: #A
b: #A
}
A :: string | [A]
#A: string | [#A]
6 changes: 3 additions & 3 deletions cmd/cue/cmd/testdata/script/issue269.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
! cue eval ./struct.cue
cmp stderr expect-stderr
-- struct.cue --
type :: {
#type: {
x: 0
y: 0

Expand All @@ -10,8 +10,8 @@ type :: {
}

data: {
a: type
b: type
a: #type
b: #type

b: x: a.x
a: y: b.y
Expand Down
8 changes: 4 additions & 4 deletions cmd/cue/cmd/testdata/script/issue302.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ cmp foo.cue rewritten
-- foo.cue --
package p

foo?: Foo
foo?: #Foo

Foo :: "hello"
#Foo: "hello"

-- rewritten --
package p

foo?: Foo
foo?: #Foo

Foo :: "hello"
#Foo: "hello"
8 changes: 4 additions & 4 deletions cmd/cue/cmd/testdata/script/issue303.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ cmp foo.cue rewritten
package example

foo: c: true
foo: M
M :: c?: bool
foo: #M
#M: c?: bool

-- rewritten --
package example

foo: c: true
foo: M
M :: c?: bool
foo: #M
#M: c?: bool
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/issue304.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cue def -e Foo x.cue
cue def -e '#Foo' x.cue
cmp stdout expect-stdout

-- expect-stdout --
Expand All @@ -13,7 +13,7 @@ close({
-- x.cue --
package example

Foo :: {
#Foo: {
x: int
body?: {
a: int
Expand Down
12 changes: 6 additions & 6 deletions cmd/cue/cmd/testdata/script/issue315.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
cmp stderr expect-stderr

-- expect-stderr --
incomplete value 'X.y' in interpolation:
incomplete value '#X.y' in interpolation:
./file.cue:16:3
./file.cue:3:5
-- file.cue --
X :: {
#X: {
x: string
y: string
z: string
}

X :: {
#X: {
x: "x"
z: "z"
}

"""
hello
world
\(X.x)
\(X.y)
\(X.z)
\(#X.x)
\(#X.y)
\(#X.z)
"""
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/vet_data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ cmp stderr vet-stderr
cmp stderr export-stderr

-- schema.cue --
Language :: {
#Language: {
tag: string
name: =~"^\\p{Lu}" // Must start with an uppercase letter.
}
languages: [...Language]
languages: [...#Language]

-- data.yaml --
languages:
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/vet_expr.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
! cue vet -d File vet.cue data.yaml
! cue vet -d '#File' vet.cue data.yaml
cmp stderr expect-stderr

-- expect-stderr --
Expand All @@ -10,7 +10,7 @@ translations.hello.lang: conflicting values false and string (mismatched types b
field "skip" not allowed in closed struct:
./data.yaml:20:7
-- vet.cue --
File :: {
#File: {
translations: [string]: {
lang: string
text: string
Expand Down
2 changes: 1 addition & 1 deletion cmd/cue/cmd/testdata/script/vet_file.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package foo

translations: [string]: lang: string

File :: {
#File: {
translations: {...}
}
-- data.yaml --
Expand Down
4 changes: 2 additions & 2 deletions cmd/cue/cmd/testdata/script/vet_opt.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ cmp stdout expect-stdout

-- expect-stdout --
-- vet.cue --
Schema1 :: {
#Schema1: {
a?: int
}
instance1: Schema1
instance1: #Schema1
14 changes: 7 additions & 7 deletions cmd/cue/cmd/testdata/script/vet_yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@ cmp stderr expect-stderr
-- expect-stderr --
phrases: error in call to encoding/yaml.Validate: missing field "text":
./yaml.cue:19:10
./yaml.cue:4:12
./yaml.cue:4:11
./yaml.cue:11:17
yaml.Validate:4:6
-- yaml.cue --
import "encoding/yaml"

// Phrases defines a schema for a valid phrase.
Phrases :: {
#Phrases: {
phrases: {
[string]: Phrase
[string]: #Phrase
}

Phrase :: {
lang: LanguageTag
#Phrase: {
lang: #LanguageTag
text: !=""
attribution?: !="" // must be non-empty when specified
}
LanguageTag :: =~"^[a-zA-Z0-9-_]{2,}$" | false
#LanguageTag: =~"^[a-zA-Z0-9-_]{2,}$" | false
}

// phrases is a YAML string with a field phrases that is a map of Phrase
// objects.
phrases: yaml.Validate(Phrases)
phrases: yaml.Validate(#Phrases)

phrases: """
phrases:
Expand Down

0 comments on commit 083afe7

Please sign in to comment.