Skip to content

Commit 8b32c49

Browse files
uhthomasmvdan
authored andcommitted
pkg/internal/builtintest: don't print superfluous newlines
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]>
1 parent deab307 commit 8b32c49

File tree

48 files changed

+6
-53
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+6
-53
lines changed

cmd/cue/cmd/testdata/script/eval_errs.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ x: {q: a, q: b}
2525

2626
foo: {a: int} | {b: string}
2727
bar: foo & {a: "str", b: 2}
28-

cmd/cue/cmd/testdata/script/eval_expr.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,3 @@ a: {
2525
c: 4
2626
}
2727
c: b & {str: "b"}
28-

cmd/cue/cmd/testdata/script/eval_import.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ import (
1212
)
1313

1414
def: #types: list.MinItems(1)
15-

cmd/cue/cmd/testdata/script/go_cmd.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@
33

44
go version
55
stdout '^go version'
6-

cmd/cue/cmd/testdata/script/vet_yaml.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,3 @@ phrases: """
3939
lang: no
4040
text: Stemmen som sier at du ikke klarer det, lyver.
4141
"""
42-

cue/ast/astutil/resolve_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func TestResolve(t *testing.T) {
6565
}, nil)
6666
w.Flush()
6767

68-
fmt.Fprintln(b)
68+
fmt.Fprint(b)
6969
}
7070
})
7171
}

cue/ast/astutil/testdata/resolve/comprehensions.txtar

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ if y > 3 {
2020
19[k]: Scope: 7[*ast.ForClause] Node: 8[k]
2121
20[v]: Scope: 7[*ast.ForClause] Node: 9[v]
2222
21[y]: Scope: 11[*ast.LetClause] Node: 12[y]
23-
2423
-- issue946.cue --
2524
x: {for a in a {}}
2625
y: {for aa in a {}}
@@ -31,4 +30,3 @@ y: {for aa in a {}}
3130
10[y]: Scope: 0[<nil>] Node: 0[]
3231
13[aa]: Scope: 0[<nil>] Node: 0[]
3332
14[a]: Scope: 0[<nil>] Node: 0[]
34-

cue/ast/astutil/testdata/resolve/fieldalias.txtar

-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ c: X
1010
9[a]: Scope: 1[*ast.File] Node: 6[int]
1111
11[c]: Scope: 0[<nil>] Node: 0[]
1212
12[X]: Scope: 1[*ast.File] Node: 2[X=a: int]
13-
1413
-- dynamic.cue --
1514
X=("foo"): int
1615
Y="\(X)": string
@@ -26,4 +25,3 @@ b: Y
2625
13[X]: Scope: 1[*ast.File] Node: 2[X=("foo"): int]
2726
15[b]: Scope: 0[<nil>] Node: 0[]
2827
16[Y]: Scope: 1[*ast.File] Node: 6[Y="\(X)": string]
29-

cue/ast/astutil/testdata/resolve/labels.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ for _ in [1] {a: _}
3232
34[_]: Scope: 0[<nil>] Node: 0[]
3333
37[a]: Scope: 0[<nil>] Node: 0[]
3434
38[_]: Scope: 0[<nil>] Node: 0[]
35-

cue/ast/astutil/testdata/resolve/let.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@ a: X
99
7[int]: Scope: 0[<nil>] Node: 0[]
1010
9[a]: Scope: 0[<nil>] Node: 0[]
1111
10[X]: Scope: 1[*ast.File] Node: 5[let X=int]
12-

cue/ast/astutil/testdata/resolve/value.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ b: X={
88
8[c]: Scope: 0[<nil>] Node: 0[]
99
9[X]: Scope: 2[*ast.Field] Node: 4[X={c: X.a}]
1010
10[a]: Scope: 0[<nil>] Node: 0[]
11-

pkg/crypto/ed25519/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,3 @@ t0: true
1717
t1: false
1818
t2: false
1919
t3: _|_ // t3: error in call to crypto/ed25519.Valid: ed25519: publicKey must be 32 bytes
20-

pkg/crypto/hmac/testdata/hmac.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@ t2: "750c783e6ab0b503eaa86e310a5db738"
1616
t3: "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7"
1717
t4: "e3d249a8cfb67ef8b7a169e9a0a599714a2cecba65999a51beb8fbbe"
1818
t5: "6eb242bdbb582ca17bebfa481b1e23211464d2b7f8c20b9ff2201637b93646af5ae9ac316e98db45d9cae773675eeed0"
19-

pkg/crypto/md5/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ import "crypto/md5"
66
t1: len(md5.Sum("hash me"))
77
-- out/md5 --
88
t1: 16
9-

pkg/crypto/sha1/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ import "crypto/sha1"
66
t1: len(sha1.Sum("hash me"))
77
-- out/sha1 --
88
t1: 20
9-

pkg/crypto/sha256/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ t3: len(sha256.Sum224("hash me"))
1010
t1: '\xeb \x1a\xf5\xaa\xf0\xd6\x06)\xd3Ҧ\x1eFl\xfc\x0f\xed\xb5\x17\xad\xd81\xec\xacR5\xe1کc\xd6'
1111
t2: 32
1212
t3: 28
13-

pkg/crypto/sha512/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ t1: 64
1212
t2: 48
1313
t3: 28
1414
t4: 32
15-

pkg/encoding/base64/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ t1: "Zm9v"
1919
t2: 'foo'
2020
t3: _|_ // t3: error in call to encoding/base64.Decode: illegal base64 data at input byte 0
2121
t4: _|_ // t4: error in call to encoding/base64.Decode: base64: unsupported encoding: cannot use value {} (type struct) as null
22-

pkg/encoding/csv/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ t3: """
1919
c
2020

2121
"""
22-

pkg/encoding/hex/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ t4: """
2020
00000000 66 6f 6f |foo|
2121

2222
"""
23-

pkg/encoding/json/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -249,4 +249,3 @@ unmarshalStream: {
249249
#result: [1, 2]
250250
}
251251
}
252-

pkg/encoding/yaml/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,3 @@ unmarshalStream: {
7575
null1: [1, null, 2]
7676
null2: [1, null, 2]
7777
}
78-

pkg/internal/builtintest/testing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,6 @@ func Run(name string, t *testing.T) {
6868
t.Fatal(err)
6969
}
7070

71-
fmt.Fprintln(t, string(b))
71+
fmt.Fprint(t, string(b))
7272
})
7373
}

pkg/list/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,3 @@ t51: false
176176
t52: true
177177
t53: false
178178
t54: _|_ // t54: error in call to list.Sort: Ascending.x: 2 errors in empty disjunction: (and 5 more errors)
179-

pkg/list/testdata/issues.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,3 @@ issue1404: {
5353
a: *1 | 2
5454
sum: 1
5555
}
56-

pkg/list/testdata/list.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -178,4 +178,3 @@ maxItems: {
178178
ok3: [0, ...]
179179
fail1: _|_ // maxItems.fail1: invalid value [0,1] (does not satisfy list.MaxItems(1)): len(list) > MaxItems(1) (2 > 1) (and 1 more errors)
180180
}
181-

pkg/list/testdata/sort.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ t3: {
5050
l2: ["c", "b", "a", "e"]
5151
l3: ["a", "b", "c", "e"]
5252
}
53-

pkg/math/bits/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,3 @@ t10: 18446744073709551871
3030
t11: 18446744073709551871
3131
t12: 7
3232
t13: 4722366482869645213696
33-

pkg/math/testdata/consts.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,3 @@ Ln2: 0.693147180559945309417232121458176568075500134360255254120680009
2626
Log2E: 1.442695040888963407359924681001892137426645954152985934135449408
2727
Ln10: 2.3025850929940456840179914546843642076011014886287729760333278
2828
Log10E: 0.43429448190325182765112891891660508229439700580366656611445378
29-

pkg/math/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,3 @@ t30: 0.6020599913279623904274777894489861
5252
t31: 2.321928094887362347870319429489391
5353
t32: 0.5
5454
t33: 0
55-

pkg/math/testdata/issue418.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ b: {
2727
x: 32.45
2828
y: _|_ // b.y: conflicting values int and 3.479700443150099001242770375542286 (mismatched types int and float)
2929
}
30-

pkg/math/testdata/round.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,3 @@ ceil0: 3
6464
ceil1: -2
6565
trunc0: 2
6666
trunc1: -2
67-

pkg/net/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,3 @@ t21: "foo%2Fbar"
6565
t22: "foo/bar"
6666
t23: "f%25o"
6767
t24: "f%o"
68-

pkg/path/testdata/error.txtar

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Copyright 2020 CUE Authors
2-
//
2+
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
55
// You may obtain a copy of the License at
6-
//
6+
//
77
// http://www.apache.org/licenses/LICENSE-2.0
8-
//
8+
//
99
// Unless required by applicable law or agreed to in writing, software
1010
// distributed under the License is distributed on an "AS IS" BASIS,
1111
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,4 +25,3 @@ joinErr: cannot use "foo" as *"unix" | "windows" | "plan9" | "aix" | "android" |
2525
Result:
2626
joinOK: "a/b"
2727
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
28-

pkg/path/testdata/issues.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ issues1025: {
1010
p: *"hello" | string
1111
q: "hello"
1212
}
13-

pkg/path/testdata/join.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -201,4 +201,3 @@ Join: {
201201
out: "\\\\host\\share\\foo"
202202
}]
203203
}
204-

pkg/path/testdata/os.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -502,4 +502,3 @@ Volume: {
502502
"//host/share/foo/../bar": "//host/share"
503503
}
504504
}
505-

pkg/regexp/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,3 @@ t13: _|_ // t13: invalid value "invalid)" (does not satisfy regexp.Valid): t13:
7070
t14: "a-l-o-at a-o-o-t -r-o-m"
7171
t15: "a-${A}-${B}-at a-${A}-${B}-t -${A}-${B}-m"
7272
t16: "a-$1-$2-at a-$1-$2-t -$1-$2-m"
73-

pkg/strconv/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,3 @@ t7: "40"
3434
t8: "170141183460469231731687303715884105728"
3535
t9: "Z"
3636
t10: "0"
37-

pkg/strings/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ t14: "hello"
6060
t15: "hello"
6161
t16: _|_ // t16: invalid value "hello" (does not satisfy strings.MaxRunes(3))
6262
t17: _|_ // t17: invalid value "hello" (does not satisfy strings.MinRunes(10))
63-

pkg/struct/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ t4: _|_ // t4: invalid value {a:1} (does not satisfy struct.MaxFields(0)): len(f
3131
t5: {
3232
a: 1
3333
}
34-

pkg/struct/testdata/struct.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,3 @@ maxFields: {
5454
}
5555
fail1: _|_ // maxFields.fail1: invalid value {a:1,b:2} (does not satisfy struct.MaxFields(1)): len(fields) > MaxFields(1) (2 > 1)
5656
}
57-

pkg/text/tabwriter/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ t2: """
2020
aaa bb vv
2121

2222
"""
23-

pkg/text/template/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ import "text/template"
66
t1: template.Execute("{{.}}-{{.}}", "foo")
77
-- out/template --
88
t1: "foo-foo"
9-

pkg/time/testdata/duration.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,3 @@ FormatDuration: [{
3737
arg: 600000000
3838
out: "600ms"
3939
}]
40-

pkg/time/testdata/gen.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,3 @@ split: {
5050
nanosecond: 123456
5151
}
5252
}
53-

pkg/uuid/testdata/uuid.txtar

-1
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,3 @@ urn: {
6767
toInt: {
6868
a: 93651793875903522077150095950593860979557386807737776869062002310283964632724204171313
6969
}
70-

tools/fix/fixall_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ func TestInstances(t *testing.T) {
3838
for _, f := range b.Files {
3939
b, _ := format.Node(f)
4040
fmt.Fprintln(t, "---", t.Rel(f.Filename))
41-
fmt.Fprintln(t, string(b))
41+
fmt.Fprint(t, string(b))
4242
}
4343
}
4444
})

0 commit comments

Comments
 (0)