Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
PyPy
pypy
Commits
adbb01ff3dac
Commit
6ed162ed
authored
Mar 04, 2021
by
Carl Friedrich Bolz-Tereick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a test for the unicode case
parent
12a7226bdbaa
Pipeline
#18786
passed with stage
in 7 minutes and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
2 deletions
+26
-2
pypy/module/pypyjit/test_pypy_c/test_string.py
pypy/module/pypyjit/test_pypy_c/test_string.py
+26
-2
No files found.
pypy/module/pypyjit/test_pypy_c/test_string.py
View file @
adbb01ff
...
...
@@ -144,11 +144,11 @@ class TestString(BaseTestPyPyC):
jump(..., descr=...)
"""
)
def
test_remove_duplicate_method_calls
(
self
):
def
test_remove_duplicate_method_calls
_bytes
(
self
):
def
main
(
n
):
lst
=
[]
for
i
in
range
(
n
):
s
=
'Hello %d'
%
i
s
=
b
'Hello %d'
%
i
t
=
s
.
lower
()
# ID: callone
u
=
s
.
lower
()
# ID: calltwo
lst
.
append
(
t
)
...
...
@@ -164,6 +164,30 @@ class TestString(BaseTestPyPyC):
'''
)
assert
loop
.
match_by_id
(
'calltwo'
,
''
)
# nothing
def
test_remove_duplicate_method_calls_unicode
(
self
):
def
main
(
n
):
lst
=
[]
for
i
in
range
(
n
):
s
=
u
'H
\xe4
llo %d'
%
i
t
=
s
.
lower
()
# ID: callone
u
=
s
.
lower
()
# ID: calltwo
lst
.
append
(
t
)
lst
.
append
(
u
)
return
len
(
','
.
join
(
lst
))
log
=
self
.
run
(
main
,
[
1000
])
assert
log
.
result
==
main
(
1000
)
loops
=
log
.
loops_by_filename
(
self
.
filepath
)
loop
,
=
loops
assert
loop
.
match_by_id
(
'callone'
,
'''
i136 = strlen(p131)
i137 = int_eq(i135, i136)
guard_false(i137, descr=...)
p139 = call_r(ConstClass(_lower_unicode), p131, descr=...)
guard_no_exception(descr=...)
guard_nonnull(p139, descr=...)
'''
)
assert
loop
.
match_by_id
(
'calltwo'
,
''
)
# nothing
def
test_move_method_call_out_of_loop
(
self
):
def
main
(
n
):
lst
=
[]
...
...
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