Skip to content

Commit 9010e28

Browse files
committed
Add Tests for Bytes Concat
1 parent ec49242 commit 9010e28

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

mypyc/test-data/irbuild-bytes.test

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,3 +299,26 @@ def foo(b: bytes, ba: bytearray) -> None:
299299
[out]
300300
main:7: error: Argument 1 to "bytes_func" has incompatible type "bytearray"; expected "bytes"
301301
main:8: error: Argument 1 to "bytearray_func" has incompatible type "bytes"; expected "bytearray"
302+
303+
[case testBytesConcatRefcount]
304+
def f(a: bytes, b: bytes) -> bytes:
305+
return b"1" + b
306+
[out]
307+
def f(a, b):
308+
a, b, r0, r1 :: bytes
309+
L0:
310+
r0 = b'1'
311+
r1 = CPyBytes_Concat(r0, b)
312+
return r1
313+
314+
[case testChainedBytesConcatRefcount]
315+
def f(a: bytes, b: bytes, c: bytes) -> bytes:
316+
return b"1" + b + c
317+
[out]
318+
def f(a, b, c):
319+
a, b, c, r0, r1, r2 :: bytes
320+
L0:
321+
r0 = b'1'
322+
r1 = CPyBytes_Concat(r0, b)
323+
r2 = CPyBytes_Concat(r1, c)
324+
return r2

0 commit comments

Comments
 (0)