Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(27)

Delta Between Two Patch Sets: src/cmd/goinstall/syslist_test.go

Issue 4172055: code review 4172055: goinstall: handle $(GOOS) and $(GOARCH) in filenames (Closed)
Left Patch Set: diff -r 66ad99aa592e https://go.googlecode.com/hg/ Created 14 years ago
Right Patch Set: diff -r 66ad99aa592e https://go.googlecode.com/hg/ Created 14 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/goinstall/parse.go ('k') | src/pkg/Makefile » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // 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 package main
5
6 import (
7 "runtime"
8 "testing"
9 )
10
11 var (
12 thisOS = runtime.GOOS
13 thisArch = runtime.GOARCH
14 otherOS = "freebsd"
15 otherArch = "arm"
16 )
17
18 func init() {
19 if thisOS == otherOS {
20 otherOS = "linux"
21 }
22 if thisArch == otherArch {
23 otherArch = "amd64"
24 }
25 }
26
27 type GoodFileTest struct {
28 name string
29 result bool
30 }
31
32 var tests = []GoodFileTest{
33 {"file.go", true},
34 {"file.c", true},
35 {"file_foo.go", true},
36 {"file_" + thisArch + ".go", true},
37 {"file_" + otherArch + ".go", false},
38 {"file_" + thisOS + ".go", true},
39 {"file_" + otherOS + ".go", false},
40 {"file_" + thisOS + "_" + thisArch + ".go", true},
41 {"file_" + otherOS + "_" + thisArch + ".go", false},
42 {"file_" + thisOS + "_" + otherArch + ".go", false},
43 {"file_" + otherOS + "_" + otherArch + ".go", false},
44 {"file_foo_" + thisArch + ".go", true},
45 {"file_foo_" + otherArch + ".go", false},
46 {"file_" + thisOS + ".c", true},
47 {"file_" + otherOS + ".c", false},
48 }
49
50 func TestGoodOSArch(t *testing.T) {
51 for _, test := range tests {
52 if goodOSArch(test.name) != test.result {
53 t.Fatalf("goodOSArch(%q) != %v", test.name, test.result)
54 }
55 }
56 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b