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

Side by Side Diff: src/pkg/go/scanner/scanner_test.go

Issue 4572049: code review 4572049: go/scanner: partially revert CL4538096 now that we have... (Closed)
Patch Set: diff -r 2fb655410b1a https://go.googlecode.com/hg/ Created 13 years, 10 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 | « src/pkg/go/scanner/scanner.go ('k') | no next file » | 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 scanner 5 package scanner
6 6
7 import ( 7 import (
8 "go/token" 8 "go/token"
9 "os" 9 "os"
10 "path/filepath" 10 "path/filepath"
(...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 } 643 }
644 } 644 }
645 645
646 646
647 var errors = []struct { 647 var errors = []struct {
648 src string 648 src string
649 tok token.Token 649 tok token.Token
650 pos int 650 pos int
651 err string 651 err string
652 }{ 652 }{
653 » {"\a", token.ILLEGAL, 0, "illegal character '\\a'"}, 653 » {"\a", token.ILLEGAL, 0, "illegal character U+0007"},
654 » {`#`, token.ILLEGAL, 0, "illegal character '#'"}, 654 » {`#`, token.ILLEGAL, 0, "illegal character U+0023 '#'"},
655 » {`…`, token.ILLEGAL, 0, "illegal character '…'"}, 655 » {`…`, token.ILLEGAL, 0, "illegal character U+2026 '…'"},
656 {`' '`, token.CHAR, 0, ""}, 656 {`' '`, token.CHAR, 0, ""},
657 {`''`, token.CHAR, 0, "illegal character literal"}, 657 {`''`, token.CHAR, 0, "illegal character literal"},
658 {`'\8'`, token.CHAR, 2, "unknown escape sequence"}, 658 {`'\8'`, token.CHAR, 2, "unknown escape sequence"},
659 {`'\08'`, token.CHAR, 3, "illegal character in escape sequence"}, 659 {`'\08'`, token.CHAR, 3, "illegal character in escape sequence"},
660 {`'\x0g'`, token.CHAR, 4, "illegal character in escape sequence"}, 660 {`'\x0g'`, token.CHAR, 4, "illegal character in escape sequence"},
661 {`'\Uffffffff'`, token.CHAR, 2, "escape sequence is invalid Unicode code point"}, 661 {`'\Uffffffff'`, token.CHAR, 2, "escape sequence is invalid Unicode code point"},
662 {`'`, token.CHAR, 0, "character literal not terminated"}, 662 {`'`, token.CHAR, 0, "character literal not terminated"},
663 {`""`, token.STRING, 0, ""}, 663 {`""`, token.STRING, 0, ""},
664 {`"`, token.STRING, 0, "string not terminated"}, 664 {`"`, token.STRING, 0, "string not terminated"},
665 {"``", token.STRING, 0, ""}, 665 {"``", token.STRING, 0, ""},
(...skipping 11 matching lines...) Expand all
677 {"\"abc\x00def\"", token.STRING, 4, "illegal character NUL"}, 677 {"\"abc\x00def\"", token.STRING, 4, "illegal character NUL"},
678 {"\"abc\x80def\"", token.STRING, 4, "illegal UTF-8 encoding"}, 678 {"\"abc\x80def\"", token.STRING, 4, "illegal UTF-8 encoding"},
679 } 679 }
680 680
681 681
682 func TestScanErrors(t *testing.T) { 682 func TestScanErrors(t *testing.T) {
683 for _, e := range errors { 683 for _, e := range errors {
684 checkError(t, e.src, e.tok, e.pos, e.err) 684 checkError(t, e.src, e.tok, e.pos, e.err)
685 } 685 }
686 } 686 }
OLDNEW
« no previous file with comments | « src/pkg/go/scanner/scanner.go ('k') | no next file » | no next file with comments »

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