blob: 070d9222ba23d7bd1ab7d0743ad56bf5a802bc70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// Copyright 2011 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.
package main
func init() {
addTestCases(oserrorstringTests)
}
var oserrorstringTests = []testCase{
{
Name: "oserrorstring.0",
In: `package main
import "os"
var _ = os.ErrorString("foo")
var _ os.Error = os.ErrorString("bar1")
var _ os.Error = os.NewError("bar2")
var _ os.Error = MyError("bal") // don't rewrite this one
var (
_ = os.ErrorString("foo")
_ os.Error = os.ErrorString("bar1")
_ os.Error = os.NewError("bar2")
_ os.Error = MyError("bal") // don't rewrite this one
)
func _() (err os.Error) {
err = os.ErrorString("foo")
return os.ErrorString("foo")
}
`,
Out: `package main
import "os"
var _ = os.NewError("foo")
var _ = os.NewError("bar1")
var _ = os.NewError("bar2")
var _ os.Error = MyError("bal") // don't rewrite this one
var (
_ = os.NewError("foo")
_ = os.NewError("bar1")
_ = os.NewError("bar2")
_ os.Error = MyError("bal") // don't rewrite this one
)
func _() (err os.Error) {
err = os.NewError("foo")
return os.NewError("foo")
}
`,
},
}
|