Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
3a6a1f9e
Commit
3a6a1f9e
authored
Feb 23, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/parser: expand test cases for bad import
R=gri CC=golang-dev
https://golang.org/cl/5697047
parent
224f05ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
14 deletions
+30
-14
src/pkg/go/parser/parser_test.go
src/pkg/go/parser/parser_test.go
+30
-14
No files found.
src/pkg/go/parser/parser_test.go
View file @
3a6a1f9e
...
@@ -207,24 +207,40 @@ func TestVarScope(t *testing.T) {
...
@@ -207,24 +207,40 @@ func TestVarScope(t *testing.T) {
}
}
var
imports
=
map
[
string
]
bool
{
var
imports
=
map
[
string
]
bool
{
"a"
:
true
,
`"a"`
:
true
,
"a/b"
:
true
,
"`a`"
:
true
,
"a.b"
:
true
,
`"a/b"`
:
true
,
"m
\x61
th"
:
true
,
`"a.b"`
:
true
,
"greek/αβ"
:
true
,
`"m\x61th"`
:
true
,
""
:
false
,
`"greek/αβ"`
:
true
,
"
\x00
"
:
false
,
`""`
:
false
,
"
\x7f
"
:
false
,
"a!"
:
false
,
// Each of these pairs tests both `` vs "" strings
"a b"
:
false
,
// and also use of invalid characters spelled out as
`a\b`
:
false
,
// escape sequences and written directly.
"`a`"
:
false
,
// For example `"\x00"` tests import "\x00"
"
\x80\x80
"
:
false
,
// while "`\x00`" tests import `<actual-NUL-byte>`.
`"\x00"`
:
false
,
"`
\x00
`"
:
false
,
`"\x7f"`
:
false
,
"`
\x7f
`"
:
false
,
`"a!"`
:
false
,
"`a!`"
:
false
,
`"a b"`
:
false
,
"`a b`"
:
false
,
`"a\\b"`
:
false
,
"`a
\\
b`"
:
false
,
"
\"
`a`
\"
"
:
false
,
"`
\"
a
\"
`"
:
false
,
`"\x80\x80"`
:
false
,
"`
\x80\x80
`"
:
false
,
`"\xFFFD"`
:
false
,
"`
\xFF
FD`"
:
false
,
}
}
func
TestImports
(
t
*
testing
.
T
)
{
func
TestImports
(
t
*
testing
.
T
)
{
for
path
,
isValid
:=
range
imports
{
for
path
,
isValid
:=
range
imports
{
src
:=
fmt
.
Sprintf
(
"package p; import %
q
"
,
path
)
src
:=
fmt
.
Sprintf
(
"package p; import %
s
"
,
path
)
_
,
err
:=
ParseFile
(
fset
,
""
,
src
,
0
)
_
,
err
:=
ParseFile
(
fset
,
""
,
src
,
0
)
switch
{
switch
{
case
err
!=
nil
&&
isValid
:
case
err
!=
nil
&&
isValid
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment