~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to src/pkg/go/parser/parser_test.go

  • Committer: Package Import Robot
  • Author(s): Serge Hallyn
  • Date: 2014-11-18 15:12:26 UTC
  • mfrom: (14.2.12 vivid-proposed)
  • Revision ID: package-import@ubuntu.com-20141118151226-zug7vn93mn3dtiz3
Tags: 2:1.3.2-1ubuntu1
* Merge from Debian unstable.  Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - Support co-installability with gccgo-go tool:
    - d/rules,golang-go.install: Rename bin/go -> bin/golang-go
    - d/golang-go.{postinst,prerm}: Install/remove /usr/bin/go using
      alternatives.
  - d/copyright: Amendments for full compiliance with copyright format.
  - d/control: Demote golang-go.tools to Suggests to support Ubuntu MIR.
  - dropped patches (now upstream):
    - d/p/issue27650045_40001_50001.diff
    - d/p/issue28050043_60001_70001.diff
    - d/p/issue54790044_100001_110001.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        }
79
79
        // sanity check
80
80
        if _, ok := x.(*ast.BinaryExpr); !ok {
81
 
                t.Errorf("ParseExpr(%s): got %T, expected *ast.BinaryExpr", src, x)
 
81
                t.Errorf("ParseExpr(%s): got %T, want *ast.BinaryExpr", src, x)
82
82
        }
83
83
 
84
84
        // a valid type expression
89
89
        }
90
90
        // sanity check
91
91
        if _, ok := x.(*ast.StructType); !ok {
92
 
                t.Errorf("ParseExpr(%s): got %T, expected *ast.StructType", src, x)
 
92
                t.Errorf("ParseExpr(%s): got %T, want *ast.StructType", src, x)
93
93
        }
94
94
 
95
95
        // an invalid expression
96
96
        src = "a + *"
97
97
        _, err = ParseExpr(src)
98
98
        if err == nil {
99
 
                t.Fatalf("ParseExpr(%s): %v", src, err)
100
 
        }
101
 
 
102
 
        // it must not crash
 
99
                t.Fatalf("ParseExpr(%s): got no error", src)
 
100
        }
 
101
 
 
102
        // a valid expression followed by extra tokens is invalid
 
103
        src = "a[i] := x"
 
104
        _, err = ParseExpr(src)
 
105
        if err == nil {
 
106
                t.Fatalf("ParseExpr(%s): got no error", src)
 
107
        }
 
108
 
 
109
        // ParseExpr must not crash
103
110
        for _, src := range valids {
104
111
                ParseExpr(src)
105
112
        }