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

Side by Side Diff: src/pkg/fmt/fmt_test.go

Issue 6331062: code review 6331062: fmt: set p.field before nil check (Closed)
Patch Set: diff -r 6f2a9ecdccf9 https://code.google.com/p/go Created 11 years, 9 months 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 | « no previous file | src/pkg/fmt/print.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 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package fmt_test 5 package fmt_test
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 . "fmt" 9 . "fmt"
10 "io" 10 "io"
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
844 844
845 func TestIsSpace(t *testing.T) { 845 func TestIsSpace(t *testing.T) {
846 // This tests the internal isSpace function. 846 // This tests the internal isSpace function.
847 // IsSpace = isSpace is defined in export_test.go. 847 // IsSpace = isSpace is defined in export_test.go.
848 for i := rune(0); i <= unicode.MaxRune; i++ { 848 for i := rune(0); i <= unicode.MaxRune; i++ {
849 if IsSpace(i) != unicode.IsSpace(i) { 849 if IsSpace(i) != unicode.IsSpace(i) {
850 t.Errorf("isSpace(%U) = %v, want %v", i, IsSpace(i), uni code.IsSpace(i)) 850 t.Errorf("isSpace(%U) = %v, want %v", i, IsSpace(i), uni code.IsSpace(i))
851 } 851 }
852 } 852 }
853 } 853 }
854
855 func TestNilDoesNotBecomeTyped(t *testing.T) {
856 type A struct{}
857 type B struct{}
858 var a *A = nil
859 var b B = B{}
860 got := Sprintf("%s %s %s %s %s", nil, a, nil, b, nil)
861 const expect = "%!s(<nil>) %!s(*fmt_test.A=<nil>) %!s(<nil>) {} %!s(<nil >)"
862 if got != expect {
863 t.Errorf("expected:\n\t%q\ngot:\n\t%q", expect, got)
864 }
865 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/fmt/print.go » ('j') | no next file with comments »

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