Skip to content

Commit

Permalink
pkg/internal/builtintest: don't print superfluous newlines
Browse files Browse the repository at this point in the history
The additional newline from Fprintln meant the test expected two
newlines rather than just one, which is incorrect.

Change-Id: I6da82454f0f4d331cf40f953ed52f62164ddcb7b
Signed-off-by: Thomas Way <[email protected]>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1171356
Reviewed-by: Daniel Martí <[email protected]>
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
  • Loading branch information
uhthomas authored and mvdan committed Nov 10, 2023
1 parent deab307 commit 8b32c49
Show file tree
Hide file tree
Showing 48 changed files with 6 additions and 53 deletions.
1 change: 0 additions & 1 deletion cmd/cue/cmd/testdata/script/eval_errs.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ x: {q: a, q: b}

foo: {a: int} | {b: string}
bar: foo & {a: "str", b: 2}

1 change: 0 additions & 1 deletion cmd/cue/cmd/testdata/script/eval_expr.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@ a: {
c: 4
}
c: b & {str: "b"}

1 change: 0 additions & 1 deletion cmd/cue/cmd/testdata/script/eval_import.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ import (
)

def: #types: list.MinItems(1)

1 change: 0 additions & 1 deletion cmd/cue/cmd/testdata/script/go_cmd.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

go version
stdout '^go version'

1 change: 0 additions & 1 deletion cmd/cue/cmd/testdata/script/vet_yaml.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ phrases: """
lang: no
text: Stemmen som sier at du ikke klarer det, lyver.
"""

2 changes: 1 addition & 1 deletion cue/ast/astutil/resolve_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestResolve(t *testing.T) {
}, nil)
w.Flush()

fmt.Fprintln(b)
fmt.Fprint(b)
}
})
}
2 changes: 0 additions & 2 deletions cue/ast/astutil/testdata/resolve/comprehensions.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ if y > 3 {
19[k]: Scope: 7[*ast.ForClause] Node: 8[k]
20[v]: Scope: 7[*ast.ForClause] Node: 9[v]
21[y]: Scope: 11[*ast.LetClause] Node: 12[y]

-- issue946.cue --
x: {for a in a {}}
y: {for aa in a {}}
Expand All @@ -31,4 +30,3 @@ y: {for aa in a {}}
10[y]: Scope: 0[<nil>] Node: 0[]
13[aa]: Scope: 0[<nil>] Node: 0[]
14[a]: Scope: 0[<nil>] Node: 0[]

2 changes: 0 additions & 2 deletions cue/ast/astutil/testdata/resolve/fieldalias.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ c: X
9[a]: Scope: 1[*ast.File] Node: 6[int]
11[c]: Scope: 0[<nil>] Node: 0[]
12[X]: Scope: 1[*ast.File] Node: 2[X=a: int]

-- dynamic.cue --
X=("foo"): int
Y="\(X)": string
Expand All @@ -26,4 +25,3 @@ b: Y
13[X]: Scope: 1[*ast.File] Node: 2[X=("foo"): int]
15[b]: Scope: 0[<nil>] Node: 0[]
16[Y]: Scope: 1[*ast.File] Node: 6[Y="\(X)": string]

1 change: 0 additions & 1 deletion cue/ast/astutil/testdata/resolve/labels.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,3 @@ for _ in [1] {a: _}
34[_]: Scope: 0[<nil>] Node: 0[]
37[a]: Scope: 0[<nil>] Node: 0[]
38[_]: Scope: 0[<nil>] Node: 0[]

1 change: 0 additions & 1 deletion cue/ast/astutil/testdata/resolve/let.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ a: X
7[int]: Scope: 0[<nil>] Node: 0[]
9[a]: Scope: 0[<nil>] Node: 0[]
10[X]: Scope: 1[*ast.File] Node: 5[let X=int]

1 change: 0 additions & 1 deletion cue/ast/astutil/testdata/resolve/value.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ b: X={
8[c]: Scope: 0[<nil>] Node: 0[]
9[X]: Scope: 2[*ast.Field] Node: 4[X={c: X.a}]
10[a]: Scope: 0[<nil>] Node: 0[]

1 change: 0 additions & 1 deletion pkg/crypto/ed25519/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ t0: true
t1: false
t2: false
t3: _|_ // t3: error in call to crypto/ed25519.Valid: ed25519: publicKey must be 32 bytes

1 change: 0 additions & 1 deletion pkg/crypto/hmac/testdata/hmac.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@ t2: "750c783e6ab0b503eaa86e310a5db738"
t3: "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"
t4: "e3d249a8cfb67ef8b7a169e9a0a599714a2cecba65999a51beb8fbbe"
t5: "6eb242bdbb582ca17bebfa481b1e23211464d2b7f8c20b9ff2201637b93646af5ae9ac316e98db45d9cae773675eeed0"

1 change: 0 additions & 1 deletion pkg/crypto/md5/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ import "crypto/md5"
t1: len(md5.Sum("hash me"))
-- out/md5 --
t1: 16

1 change: 0 additions & 1 deletion pkg/crypto/sha1/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ import "crypto/sha1"
t1: len(sha1.Sum("hash me"))
-- out/sha1 --
t1: 20

1 change: 0 additions & 1 deletion pkg/crypto/sha256/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ t3: len(sha256.Sum224("hash me"))
t1: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)\xd3Ҧ\x1eFl\xfc\x0f\xed\xb5\x17\xad\xd81\xec\xacR5\xe1کc\xd6'
t2: 32
t3: 28

1 change: 0 additions & 1 deletion pkg/crypto/sha512/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ t1: 64
t2: 48
t3: 28
t4: 32

1 change: 0 additions & 1 deletion pkg/encoding/base64/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ t1: "Zm9v"
t2: 'foo'
t3: _|_ // t3: error in call to encoding/base64.Decode: illegal base64 data at input byte 0
t4: _|_ // t4: error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null

1 change: 0 additions & 1 deletion pkg/encoding/csv/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ t3: """
c

"""

1 change: 0 additions & 1 deletion pkg/encoding/hex/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ t4: """
00000000 66 6f 6f |foo|

"""

1 change: 0 additions & 1 deletion pkg/encoding/json/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -249,4 +249,3 @@ unmarshalStream: {
#result: [1, 2]
}
}

1 change: 0 additions & 1 deletion pkg/encoding/yaml/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,3 @@ unmarshalStream: {
null1: [1, null, 2]
null2: [1, null, 2]
}

2 changes: 1 addition & 1 deletion pkg/internal/builtintest/testing.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@ func Run(name string, t *testing.T) {
t.Fatal(err)
}

fmt.Fprintln(t, string(b))
fmt.Fprint(t, string(b))
})
}
1 change: 0 additions & 1 deletion pkg/list/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,3 @@ t51: false
t52: true
t53: false
t54: _|_ // t54: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors)

1 change: 0 additions & 1 deletion pkg/list/testdata/issues.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ issue1404: {
a: *1 | 2
sum: 1
}

1 change: 0 additions & 1 deletion pkg/list/testdata/list.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,3 @@ maxItems: {
ok3: [0, ...]
fail1: _|_ // maxItems.fail1: invalid value [0,1] (does not satisfy list.MaxItems(1)): len(list) > MaxItems(1) (2 > 1) (and 1 more errors)
}

1 change: 0 additions & 1 deletion pkg/list/testdata/sort.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ t3: {
l2: ["c", "b", "a", "e"]
l3: ["a", "b", "c", "e"]
}

1 change: 0 additions & 1 deletion pkg/math/bits/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ t10: 18446744073709551871
t11: 18446744073709551871
t12: 7
t13: 4722366482869645213696

1 change: 0 additions & 1 deletion pkg/math/testdata/consts.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,3 @@ Ln2: 0.693147180559945309417232121458176568075500134360255254120680009
Log2E: 1.442695040888963407359924681001892137426645954152985934135449408
Ln10: 2.3025850929940456840179914546843642076011014886287729760333278
Log10E: 0.43429448190325182765112891891660508229439700580366656611445378

1 change: 0 additions & 1 deletion pkg/math/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,3 @@ t30: 0.6020599913279623904274777894489861
t31: 2.321928094887362347870319429489391
t32: 0.5
t33: 0

1 change: 0 additions & 1 deletion pkg/math/testdata/issue418.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,3 @@ b: {
x: 32.45
y: _|_ // b.y: conflicting values int and 3.479700443150099001242770375542286 (mismatched types int and float)
}

1 change: 0 additions & 1 deletion pkg/math/testdata/round.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,3 @@ ceil0: 3
ceil1: -2
trunc0: 2
trunc1: -2

1 change: 0 additions & 1 deletion pkg/net/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,3 @@ t21: "foo%2Fbar"
t22: "foo/bar"
t23: "f%25o"
t24: "f%o"

7 changes: 3 additions & 4 deletions pkg/path/testdata/error.txtar
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2020 CUE Authors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -25,4 +25,3 @@ joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" |
Result:
joinOK: "a/b"
joinErr: _|_ // joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" | "darwin" | "dragonfly" | "freebsd" | "hurd" | "illumos" | "ios" | "js" | "linux" | "nacl" | "netbsd" | "openbsd" | "solaris" | "zos" in argument 2 to path.Join

1 change: 0 additions & 1 deletion pkg/path/testdata/issues.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,3 @@ issues1025: {
p: *"hello" | string
q: "hello"
}

1 change: 0 additions & 1 deletion pkg/path/testdata/join.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,3 @@ Join: {
out: "\\\\host\\share\\foo"
}]
}

1 change: 0 additions & 1 deletion pkg/path/testdata/os.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -502,4 +502,3 @@ Volume: {
"//host/share/foo/../bar": "//host/share"
}
}

1 change: 0 additions & 1 deletion pkg/regexp/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,3 @@ t13: _|_ // t13: invalid value "invalid)" (does not satisfy regexp.Valid): t13:
t14: "a-l-o-at a-o-o-t -r-o-m"
t15: "a-${A}-${B}-at a-${A}-${B}-t -${A}-${B}-m"
t16: "a-$1-$2-at a-$1-$2-t -$1-$2-m"

1 change: 0 additions & 1 deletion pkg/strconv/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,3 @@ t7: "40"
t8: "170141183460469231731687303715884105728"
t9: "Z"
t10: "0"

1 change: 0 additions & 1 deletion pkg/strings/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ t14: "hello"
t15: "hello"
t16: _|_ // t16: invalid value "hello" (does not satisfy strings.MaxRunes(3))
t17: _|_ // t17: invalid value "hello" (does not satisfy strings.MinRunes(10))

1 change: 0 additions & 1 deletion pkg/struct/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ t4: _|_ // t4: invalid value {a:1} (does not satisfy struct.MaxFields(0)): len(f
t5: {
a: 1
}

1 change: 0 additions & 1 deletion pkg/struct/testdata/struct.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,3 @@ maxFields: {
}
fail1: _|_ // maxFields.fail1: invalid value {a:1,b:2} (does not satisfy struct.MaxFields(1)): len(fields) > MaxFields(1) (2 > 1)
}

1 change: 0 additions & 1 deletion pkg/text/tabwriter/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ t2: """
aaa bb vv

"""

1 change: 0 additions & 1 deletion pkg/text/template/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ import "text/template"
t1: template.Execute("{{.}}-{{.}}", "foo")
-- out/template --
t1: "foo-foo"

1 change: 0 additions & 1 deletion pkg/time/testdata/duration.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,3 @@ FormatDuration: [{
arg: 600000000
out: "600ms"
}]

1 change: 0 additions & 1 deletion pkg/time/testdata/gen.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ split: {
nanosecond: 123456
}
}

1 change: 0 additions & 1 deletion pkg/uuid/testdata/uuid.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ urn: {
toInt: {
a: 93651793875903522077150095950593860979557386807737776869062002310283964632724204171313
}

2 changes: 1 addition & 1 deletion tools/fix/fixall_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func TestInstances(t *testing.T) {
for _, f := range b.Files {
b, _ := format.Node(f)
fmt.Fprintln(t, "---", t.Rel(f.Filename))
fmt.Fprintln(t, string(b))
fmt.Fprint(t, string(b))
}
}
})
Expand Down

0 comments on commit 8b32c49

Please sign in to comment.