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

Side by Side Diff: test/literal.go

Issue 7310087: code review 7310087: test: ensure all failing tests exit nonzero. (Closed)
Patch Set: diff -r 36b36840f7f1 https://code.google.com/p/go/ Created 12 years, 1 month 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:
View unified diff | Download patch
« no previous file with comments | « test/init1.go ('k') | test/map.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // run 1 // run
2 2
3 // Copyright 2009 The Go Authors. All rights reserved. 3 // Copyright 2009 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style 4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file. 5 // license that can be found in the LICENSE file.
6 6
7 // Test literal syntax for basic types. 7 // Test literal syntax for basic types.
8 8
9 package main 9 package main
10 10
11 var nbad int 11 var nbad int
12 12
13 func assert(cond bool, msg string) { 13 func assert(cond bool, msg string) {
14 if !cond { 14 if !cond {
15 if nbad == 0 { 15 if nbad == 0 {
16 print("BUG") 16 print("BUG")
17 } 17 }
18 nbad++ 18 nbad++
19 print(" ", msg) 19 print(" ", msg)
20 } 20 }
21 } 21 }
22 22
23 func equal(a, b float32) bool { 23 func equal(a, b float32) bool {
24 return a == b 24 return a == b
25 } 25 }
26 26
27
28 func main() { 27 func main() {
29 // bool 28 // bool
30 var t bool = true 29 var t bool = true
31 var f bool = false 30 var f bool = false
32 assert(t == !f, "bool") 31 assert(t == !f, "bool")
33 32
34 // int8 33 // int8
35 var i00 int8 = 0 34 var i00 int8 = 0
36 var i01 int8 = 1 35 var i01 int8 = 1
37 var i02 int8 = -1 36 var i02 int8 = -1
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // these are all the same string 217 // these are all the same string
219 var sj0 string = "日本語" 218 var sj0 string = "日本語"
220 var sj1 string = "\u65e5\u672c\u8a9e" 219 var sj1 string = "\u65e5\u672c\u8a9e"
221 var sj2 string = "\U000065e5\U0000672c\U00008a9e" 220 var sj2 string = "\U000065e5\U0000672c\U00008a9e"
222 var sj3 string = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e" 221 var sj3 string = "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e"
223 assert(sj0 == sj1, "sj1") 222 assert(sj0 == sj1, "sj1")
224 assert(sj0 == sj2, "sj2") 223 assert(sj0 == sj2, "sj2")
225 assert(sj0 == sj3, "sj3") 224 assert(sj0 == sj3, "sj3")
226 225
227 if nbad > 0 { 226 if nbad > 0 {
228 » » println() 227 » » panic("literal failed")
229 } 228 }
230 } 229 }
OLDNEW
« no previous file with comments | « test/init1.go ('k') | test/map.go » ('j') | no next file with comments »

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