Skip to content

Commit

Permalink
Revert gofmt in test/ dir
Browse files Browse the repository at this point in the history
test/ files now match current master HEAD at 7bab1ee
  • Loading branch information
whilei committed Jun 14, 2018
1 parent 2060068 commit a2ccf56
Show file tree
Hide file tree
Showing 524 changed files with 3,855 additions and 4,561 deletions.
4 changes: 3 additions & 1 deletion test/235.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ func M(f uint64) (in, out T) {
out = make(T, 100)
go func(in, out T, f uint64) {
for {
out <- f * <-in
out <- f*<-in
}
}(in, out, f)
return in, out
}


func min(xs []uint64) uint64 {
m := xs[0]
for i := 1; i < len(xs); i++ {
Expand All @@ -32,6 +33,7 @@ func min(xs []uint64) uint64 {
return m
}


func main() {
F := []uint64{2, 3, 5}
var n = len(F)
Expand Down
48 changes: 24 additions & 24 deletions test/64bit.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ var bout *bufio.Writer
// if the compiler has buggy or missing 64-bit support.

type Uint64 struct {
hi uint32
lo uint32
hi uint32
lo uint32
}

type Int64 struct {
hi int32
lo uint32
hi int32
lo uint32
}

func (a Uint64) Int64() (c Int64) {
Expand Down Expand Up @@ -170,7 +170,7 @@ func (a Uint64) DivMod(b Uint64) (quo, rem Uint64) {
b = b.LeftShift(uint(n))
for i := 0; i <= n; i++ {
quo = quo.LeftShift(1)
if b.Cmp(a) <= 0 { // b <= a
if b.Cmp(a) <= 0 { // b <= a
quo.lo |= 1
a = a.Minus(b)
}
Expand Down Expand Up @@ -205,7 +205,7 @@ func (a Uint64) Xor(b Uint64) (c Uint64) {
return
}

func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) }
func (a Uint64) String() string { return fmt.Sprintf("%#x%08x", a.hi, a.lo) }

func (a Int64) Uint64() (c Uint64) {
c.hi = uint32(a.hi)
Expand All @@ -230,15 +230,15 @@ func (a Int64) Cmp(b Int64) int {
return 0
}

func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() }
func (a Int64) LeftShift(b uint) (c Int64) { return a.Uint64().LeftShift(b).Int64() }

func (a Int64) RightShift(b uint) (c Int64) {
switch {
case b >= 64:
c.hi = a.hi >> 31 // sign extend
c.hi = a.hi >> 31 // sign extend
c.lo = uint32(c.hi)
case b >= 32:
c.hi = a.hi >> 31 // sign extend
c.hi = a.hi >> 31 // sign extend
c.lo = uint32(a.hi >> (b - 32))
default:
c.hi = a.hi >> b
Expand All @@ -261,15 +261,15 @@ func (a Int64) RightShift64(b Uint64) (c Int64) {
return a.RightShift(uint(b.lo))
}

func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() }
func (a Int64) Plus(b Int64) (c Int64) { return a.Uint64().Plus(b.Uint64()).Int64() }

func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() }
func (a Int64) Minus(b Int64) (c Int64) { return a.Uint64().Minus(b.Uint64()).Int64() }

func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() }
func (a Int64) Neg() (c Int64) { return a.Uint64().Neg().Int64() }

func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() }
func (a Int64) Com() (c Int64) { return a.Uint64().Com().Int64() }

func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() }
func (a Int64) Times(b Int64) (c Int64) { return a.Uint64().Times(b.Uint64()).Int64() }

func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) {
var zero Int64
Expand Down Expand Up @@ -299,13 +299,13 @@ func (a Int64) DivMod(b Int64) (quo Int64, rem Int64) {
return
}

func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() }
func (a Int64) And(b Int64) (c Int64) { return a.Uint64().And(b.Uint64()).Int64() }

func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() }
func (a Int64) AndNot(b Int64) (c Int64) { return a.Uint64().AndNot(b.Uint64()).Int64() }

func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() }
func (a Int64) Or(b Int64) (c Int64) { return a.Uint64().Or(b.Uint64()).Int64() }

func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() }
func (a Int64) Xor(b Int64) (c Int64) { return a.Uint64().Xor(b.Uint64()).Int64() }

func (a Int64) String() string {
if a.hi < 0 {
Expand Down Expand Up @@ -514,11 +514,11 @@ func varTests() {
var div, mod Int64
dodiv := false
var zero Int64
if b.Cmp(zero) != 0 { // b != 0
if b.Cmp(zero) != 0 { // b != 0
// Can't divide by zero but also can't divide -0x8000...000 by -1.
var bigneg = Int64{-0x80000000, 0}
var minus1 = Int64{-1, ^uint32(0)}
if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1
if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1
div, mod = a.DivMod(b)
dodiv = true
}
Expand All @@ -542,7 +542,7 @@ func varTests() {
var div, mod Uint64
dodiv := false
var zero Uint64
if b.Cmp(zero) != 0 { // b != 0
if b.Cmp(zero) != 0 { // b != 0
div, mod = a.DivMod(b)
dodiv = true
}
Expand Down Expand Up @@ -661,11 +661,11 @@ func constTests() {
var div, mod Int64
dodiv := false
var zero Int64
if b.Cmp(zero) != 0 { // b != 0
if b.Cmp(zero) != 0 { // b != 0
// Can't divide by zero but also can't divide -0x8000...000 by -1.
var bigneg = Int64{-0x80000000, 0}
var minus1 = Int64{-1, ^uint32(0)}
if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1
if a.Cmp(bigneg) != 0 || b.Cmp(minus1) != 0 { // a != -1<<63 || b != -1
div, mod = a.DivMod(b)
dodiv = true
}
Expand All @@ -692,7 +692,7 @@ func constTests() {
var div, mod Uint64
dodiv := false
var zero Uint64
if b.Cmp(zero) != 0 { // b != 0
if b.Cmp(zero) != 0 { // b != 0
div, mod = a.DivMod(b)
dodiv = true
}
Expand Down
2 changes: 1 addition & 1 deletion test/align.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ package main
// introduced by CL 102036.
type T struct {
pad uint32
f float64
f float64
}

//go:noinline
Expand Down
5 changes: 3 additions & 2 deletions test/assign1.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func main() {
ps1 = ps0 // ERROR "cannot use|incompatible"
ps1 = ps // ERROR "cannot use|incompatible"


a0 = [10]int(a)
a0 = [10]int(a1)
a = A(a0)
Expand All @@ -235,8 +236,8 @@ func main() {
c1 = C1(c0)
c1 = C1(c)

f0 = (func() int)(f)
f0 = (func() int)(f1)
f0 = func() int(f)
f0 = func() int(f1)
f = F(f0)
f = F(f1)
f1 = F1(f0)
Expand Down
7 changes: 4 additions & 3 deletions test/bigmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ func main() {
cmp(m[1], seq(11, 13))
cmp(m[2], seq(2, 9))
cmp(m[3], seq(3, 17))


{
type T [1]byte
Expand All @@ -46,7 +47,7 @@ func main() {
println(x, y)
panic("bad map")
}
}
}
{
type T [100]byte
type V [1]byte
Expand Down Expand Up @@ -133,6 +134,6 @@ func main() {
if x, y := m[T{}][0], m[T{1}][0]; x != 1 || y != 2 {
println(x, y)
panic("bad map")
}
}
}
}
}
12 changes: 6 additions & 6 deletions test/blank1.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Test that incorrect uses of the blank identifer are caught.
// Does not compile.

package _ // ERROR "invalid package name _"
package _ // ERROR "invalid package name _"

var t struct {
_ int
Expand All @@ -18,15 +18,15 @@ func (x int) _() { // ERROR "cannot define new methods on non-local type"
}

type T struct {
_ []int
_ []int
}

func main() {
_() // ERROR "cannot use _ as value"
x := _ + 1 // ERROR "cannot use _ as value"
_() // ERROR "cannot use _ as value"
x := _+1 // ERROR "cannot use _ as value"
_ = x
_ = t._ // ERROR "cannot refer to blank field|invalid use of"

var v1, v2 T
_ = v1 == v2 // ERROR "cannot be compared|non-comparable"
var v1, v2 T
_ = v1 == v2 // ERROR "cannot be compared|non-comparable"
}
3 changes: 2 additions & 1 deletion test/char_lit.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ package main
import "os"

func main() {
var i uint64 = ' ' +
var i uint64 =
' ' +
'a' +
'ä' +
'本' +
Expand Down
15 changes: 8 additions & 7 deletions test/closedchan.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var failed bool
type Chan interface {
Send(int)
Nbsend(int) bool
Recv() int
Recv() (int)
Nbrecv() (int, bool)
Recv2() (int, bool)
Nbrecv2() (int, bool, bool)
Expand Down Expand Up @@ -214,6 +214,7 @@ func (c SSChan) Impl() string {
return "(select)"
}


func shouldPanic(f func()) {
defer func() {
if recover() == nil {
Expand Down Expand Up @@ -317,13 +318,13 @@ func closedasync() chan int {
return c
}

var mks = []func(chan int) Chan{
var mks = []func(chan int) Chan {
func(c chan int) Chan { return XChan(c) },
func(c chan int) Chan { return SChan(c) },
func(c chan int) Chan { return SSChan(c) },
}

var testcloseds = []func(Chan){
var testcloseds = []func(Chan) {
testasync1,
testasync2,
testasync3,
Expand All @@ -334,18 +335,18 @@ func main() {
for _, mk := range mks {
test1(mk(closedsync()))
}

for _, testclosed := range testcloseds {
for _, mk := range mks {
testclosed(mk(closedasync()))
}
}

var ch chan int
var ch chan int
shouldPanic(func() {
close(ch)
})

ch = make(chan int)
close(ch)
shouldPanic(func() {
Expand Down
2 changes: 1 addition & 1 deletion test/closure1.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ func main() {
panic("x != 1")
}
}()
}
}
4 changes: 2 additions & 2 deletions test/closure2.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func main() {
q++
g = func() int {
return q // test that we capture by ref here
// q++ must on a different decldepth than q declaration
// q++ must on a different decldepth than q declaration
}
}
if g() != 2 {
Expand All @@ -108,7 +108,7 @@ func main() {
}()] = range [2]int{} {
g = func() int {
return q // test that we capture by ref here
// q++ must on a different decldepth than q declaration
// q++ must on a different decldepth than q declaration
}
}
if g() != 2 {
Expand Down
6 changes: 3 additions & 3 deletions test/cmplxdivide1.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package main
import "math"

var (
nan = math.NaN()
inf = math.Inf(1)
zero = 0.0
nan = math.NaN()
inf = math.Inf(1)
zero = 0.0
)

var tests = []struct {
Expand Down
2 changes: 1 addition & 1 deletion test/codegen/copy.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func moveDisjointStack() {
runtime.KeepAlive(&s)
}

func moveDisjointArg(b *[256]byte) {
func moveDisjointArg(b *[256]byte) {
var s [256]byte
// s390x:-".*memmove"
copy(s[:], b[:])
Expand Down
Loading

0 comments on commit a2ccf56

Please sign in to comment.