Commit 64f78c91 authored by Russ Cox's avatar Russ Cox

test: error-related fixes

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/5328051
parent 29fb5d3e
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
package main package main
type S struct { type S struct {
err os.Error // ERROR "undefined|expected package" err foo.Bar // ERROR "undefined|expected package"
Num int Num int
} }
......
...@@ -13,13 +13,12 @@ import _os_ "os" ...@@ -13,13 +13,12 @@ import _os_ "os"
import "os" import "os"
import . "os" import . "os"
func f(e os.Error) func f(e *os.File)
func main() { func main() {
var _e_ _os_.Error var _e_ *_os_.File
var dot Error var dot *File
f(_e_) f(_e_)
f(dot) f(dot)
} }
...@@ -9,13 +9,10 @@ package main ...@@ -9,13 +9,10 @@ package main
import ( import (
"fmt" "fmt"
"math" "math"
"runtime"
"strings" "strings"
) )
type Error interface {
String() string
}
type ErrorTest struct { type ErrorTest struct {
name string name string
fn func() fn func()
...@@ -164,7 +161,7 @@ var errorTests = []ErrorTest{ ...@@ -164,7 +161,7 @@ var errorTests = []ErrorTest{
func error(fn func()) (error string) { func error(fn func()) (error string) {
defer func() { defer func() {
if e := recover(); e != nil { if e := recover(); e != nil {
error = e.(Error).String() error = e.(runtime.Error).String()
} }
}() }()
fn() fn()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment