OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |