~push-gopher/golang/stable

« back to all changes in this revision

Viewing changes to src/cmd/vet/test_taglit.go

  • Committer: Push Gopher
  • Author(s): Rob Pike
  • Date: 2013-06-13 01:13:34 UTC
  • Revision ID: push-gopher@niemeyer.net-20130613011334-81ucwaa7ggbi8xsi
testing: add -outputdir flag so "go test" controls where the files are written
Obscure misfeature now fixed: When run from "go test", profiles were always
written in the package's source directory. This change puts them in the directory
where "go test" is run.
Also fix a couple of problems causing errors in testing.after to go unreported
unless -v was set.

R=rsc, minux.ma, iant, alex.brainman
CC=golang-dev
https://codereview.appspot.com/10234044
HG=17064:3018dd1d3e6f

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Copyright 2012 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
 
// This file contains tests for the untagged struct literal checker.
6
 
 
7
 
// +build vet_test
8
 
 
9
 
// This file contains the test for untagged struct literals.
10
 
 
11
 
package main
12
 
 
13
 
import (
14
 
        "flag"
15
 
        "go/scanner"
16
 
)
17
 
 
18
 
var Okay1 = []string{
19
 
        "Name",
20
 
        "Usage",
21
 
        "DefValue",
22
 
}
23
 
 
24
 
var Okay2 = map[string]bool{
25
 
        "Name":     true,
26
 
        "Usage":    true,
27
 
        "DefValue": true,
28
 
}
29
 
 
30
 
var Okay3 = struct {
31
 
        X string
32
 
        Y string
33
 
        Z string
34
 
}{
35
 
        "Name",
36
 
        "Usage",
37
 
        "DefValue",
38
 
}
39
 
 
40
 
type MyStruct struct {
41
 
        X string
42
 
        Y string
43
 
        Z string
44
 
}
45
 
 
46
 
var Okay4 = MyStruct{
47
 
        "Name",
48
 
        "Usage",
49
 
        "DefValue",
50
 
}
51
 
 
52
 
// Testing is awkward because we need to reference things from a separate package
53
 
// to trigger the warnings.
54
 
 
55
 
var BadStructLiteralUsedInTests = flag.Flag{ // ERROR "untagged fields"
56
 
        "Name",
57
 
        "Usage",
58
 
        nil, // Value
59
 
        "DefValue",
60
 
}
61
 
 
62
 
// Used to test the check for slices and arrays: If that test is disabled and
63
 
// vet is run with --compositewhitelist=false, this line triggers an error.
64
 
// Clumsy but sufficient.
65
 
var scannerErrorListTest = scanner.ErrorList{nil, nil}