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
f07d2eea
Commit
f07d2eea
authored
Jun 08, 2008
by
Rob Pike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix string_lit test to be more thorough
SVN=121623
parent
f9c58c25
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
24 deletions
+70
-24
test/golden.out
test/golden.out
+0
-3
test/string_lit.go
test/string_lit.go
+70
-21
No files found.
test/golden.out
View file @
f07d2eea
...
...
@@ -41,9 +41,6 @@ sieve.go:8: fatal error: walktype: switch 1 unknown op SEND l(8)
BUG: known to fail incorrectly
=========== ./string_lit.go
string_lit.go:5: syntax error
string_lit.go:12: unknown escape sequence: \
BUG: known to fail incorrectly
=========== ./switch.go
...
...
test/string_lit.go
View file @
f07d2eea
...
...
@@ -6,25 +6,74 @@
package
main
func
main
()
{
[]
string
(
""
,
" "
,
"'`"
,
"a"
,
"ä"
,
"本"
,
"
\a\b\f\n\r\t\v\\\"
"
,
"
\0
00
\1
23
\x00\xca\xFE\u0123\ubabe\U0123ABCD\Ucafebabe
"
,
``
,
` `
,
`'"`
,
`a`
,
`ä`
,
`本`
,
`\a\b\f\n\r\t\v\\\'\"`
,
`\000\123\x00\xca\xFE\u0123\ubabe\U0123ABCD\Ucafebabe`
,
`\x\u\U\`
);
var
ecode
int
;
func
assert
(
a
,
b
,
c
string
)
{
if
a
!=
b
{
ecode
=
1
;
print
"FAIL: "
,
c
,
": "
,
a
,
"!="
,
b
,
"
\n
"
;
var
max
int
=
len
(
a
);
if
len
(
b
)
>
max
{
max
=
len
(
b
);
}
for
i
:=
0
;
i
<
max
;
i
++
{
ac
:=
0
;
bc
:=
0
;
if
i
<
len
(
a
)
{
ac
=
int
(
a
[
i
]);
}
if
i
<
len
(
b
)
{
bc
=
int
(
b
[
i
]);
}
if
ac
!=
bc
{
print
"
\t
a["
,
i
,
"] = "
,
ac
,
"; b["
,
i
,
"] ="
,
bc
,
"
\n
"
;
}
}
}
}
func
main
()
int
{
ecode
=
0
;
s
:=
""
" "
"'`"
"a"
"ä"
"本"
"
\a\b\f\n\r\t\v\\\"
"
"
\0
00
\1
23
\x00\xca\xFE\u0123\ubabe\U0000babe
"
``
` `
`'"`
`a`
`ä`
`本`
`\a\b\f\n\r\t\v\\\'`
`\000\123\x00\xca\xFE\u0123\ubabe\U0000babe`
`\x\u\U\`
;
assert
(
""
,
``
,
"empty"
);
assert
(
" "
,
" "
,
"blank"
);
assert
(
"
\x61
"
,
"a"
,
"lowercase a"
);
assert
(
"
\x61
"
,
`a`
,
"lowercase a (backquote)"
);
assert
(
"
\u00e4
"
,
"ä"
,
"a umlaut"
);
assert
(
"
\u00e4
"
,
`ä`
,
"a umlaut (backquote)"
);
assert
(
"
\u672c
"
,
"本"
,
"nihon"
);
assert
(
"
\u672c
"
,
`本`
,
"nihon (backquote)"
);
assert
(
"
\x07\x08\x0c\x0a\x0d\x09\x0b\x5c\x22
"
,
"
\a\b\f\n\r\t\v\\\"
"
,
"backslashes"
);
assert
(
"
\\
a
\\
b
\\
f
\\
n
\\
r
\\
t
\\
v
\\\\\\\"
"
,
`\a\b\f\n\r\t\v\\\"`
,
"backslashes (backquote)"
);
assert
(
"
\x00\x53
\0
00
\xca
\3
76S몾몾"
,
"
\0
00
\1
23
\x00
\3
12
\xFE\u0053\ubabe\U0000babe
"
,
"backslashes 2"
);
assert
(
"
\\
000
\\
123
\\
x00
\\
312
\\
xFE
\\
u0123
\\
ubabe
\\
U0000babe"
,
`\000\123\x00\312\xFE\u0123\ubabe\U0000babe`
,
"backslashes 2 (backquote)"
);
assert
(
"
\\
x
\\
u
\\
U
\\
"
,
`\x\u\U\`
,
"backslash 3 (backquote)"
);
return
ecode
;
}
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