Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
Pyston
Commits
ce0618d4
Commit
ce0618d4
authored
Apr 25, 2014
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix str.split and add some test cases for it
parent
36f59af3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
5 deletions
+15
-5
src/runtime/float.cpp
src/runtime/float.cpp
+1
-1
src/runtime/str.cpp
src/runtime/str.cpp
+10
-4
test/tests/str_functions.py
test/tests/str_functions.py
+4
-0
No files found.
src/runtime/float.cpp
View file @
ce0618d4
...
...
@@ -453,7 +453,7 @@ Box* floatNew2(BoxedClass *cls, Box* a) {
if
(
s
==
"-inf"
)
return
boxFloat
(
-
INFINITY
);
RELEASE_ASSERT
(
0
,
"%s"
,
s
.
c_str
(
));
return
boxFloat
(
strtod
(
s
.
c_str
(),
NULL
));
}
RELEASE_ASSERT
(
0
,
"%s"
,
getTypeName
(
a
)
->
c_str
());
}
...
...
src/runtime/str.cpp
View file @
ce0618d4
...
...
@@ -330,12 +330,18 @@ Box* strSplit1(BoxedString* self) {
std
::
ostringstream
os
(
""
);
for
(
char
c
:
self
->
s
)
{
if
(
c
==
' '
||
c
==
'\t'
||
c
==
'\n'
||
c
==
'\r'
||
c
==
'\f'
)
{
listAppendInternal
(
rtn
,
boxString
(
os
.
str
()));
os
.
str
(
""
);
if
(
c
==
' '
||
c
==
'\t'
||
c
==
'\n'
||
c
==
'\r'
||
c
==
'\f'
||
c
==
'\v'
)
{
if
(
os
.
tellp
())
{
listAppendInternal
(
rtn
,
boxString
(
os
.
str
()));
os
.
str
(
""
);
}
}
else
{
os
<<
c
;
}
}
listAppendInternal
(
rtn
,
boxString
(
os
.
str
()));
if
(
os
.
tellp
())
{
listAppendInternal
(
rtn
,
boxString
(
os
.
str
()));
}
return
rtn
;
}
...
...
test/tests/str_functions.py
View file @
ce0618d4
...
...
@@ -4,3 +4,7 @@ print repr(chr(0) + chr(180))
print
repr
(
'"'
)
# print repr("'") // don't feel like handling this right now; this should print out (verbatim) "'", ie realize it can use double quotes
print
repr
(
"'
\
"
"
)
print
"hello world
\
t
more
\
n
words
\
v
a
\
f
b
\
a
o"
.
split
()
print
" test "
.
split
()
# print " test ".split(' ')
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