OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [errors/] [errors_test.go] - Blame information for rev 747

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2011 The Go Authors.  All rights reserved.
2
// Use of this source code is governed by a BSD-style
3
// license that can be found in the LICENSE file.
4
 
5
package errors_test
6
 
7
import (
8
        . "errors"
9
        "testing"
10
)
11
 
12
func TestNewEqual(t *testing.T) {
13
        // Different allocations should not be equal.
14
        if New("abc") == New("abc") {
15
                t.Errorf(`New("abc") == New("abc")`)
16
        }
17
        if New("abc") == New("xyz") {
18
                t.Errorf(`New("abc") == New("xyz")`)
19
        }
20
 
21
        // Same allocation should be equal to itself (not crash).
22
        err := New("jkl")
23
        if err != err {
24
                t.Errorf(`err != err`)
25
        }
26
}
27
 
28
func TestErrorMethod(t *testing.T) {
29
        err := New("abc")
30
        if err.Error() != "abc" {
31
                t.Errorf(`New("abc").Error() = %q, want %q`, err.Error(), "abc")
32
        }
33
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.