2012-02-18 14:15:42 -07:00
|
|
|
// run
|
2008-11-17 13:19:02 -07:00
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2012-02-23 17:48:19 -07:00
|
|
|
// Test var x = x + 1 works.
|
|
|
|
|
2008-11-17 13:19:02 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
func main() {
|
2010-03-30 11:34:57 -06:00
|
|
|
var x int = 1
|
|
|
|
if x != 1 {
|
|
|
|
print("found ", x, ", expected 1\n")
|
|
|
|
panic("fail")
|
|
|
|
}
|
2009-08-17 14:30:22 -06:00
|
|
|
{
|
2010-03-30 11:34:57 -06:00
|
|
|
var x int = x + 1
|
|
|
|
if x != 2 {
|
|
|
|
print("found ", x, ", expected 2\n")
|
|
|
|
panic("fail")
|
|
|
|
}
|
2009-08-17 14:30:22 -06:00
|
|
|
}
|
|
|
|
{
|
2010-03-30 11:34:57 -06:00
|
|
|
x := x + 1
|
|
|
|
if x != 2 {
|
|
|
|
print("found ", x, ", expected 2\n")
|
|
|
|
panic("fail")
|
|
|
|
}
|
2009-08-17 14:30:22 -06:00
|
|
|
}
|
2008-11-17 13:19:02 -07:00
|
|
|
}
|