Skip to content

Commit 381c584

Browse files
committed
Test partition with UTF8 string per
#15409 (comment) remove FIXMEs per #15409 (comment)
1 parent a12fea0 commit 381c584

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

base/iterator.jl

+2-5
Original file line numberDiff line numberDiff line change
@@ -481,11 +481,8 @@ julia> collect(partition([1,2,3,4,5], 2))
481481
[5]
482482
```
483483
"""
484-
function partition{T}(c::T, n::Int)
485-
# FIXME Use @require per https://github.com/JuliaLang/julia/pull/15495
486-
@assert n > 0
487-
return PartitionIterator{T}(c, n)
488-
end
484+
partition{T}(c::T, n::Int) = PartitionIterator{T}(c, n)
485+
489486

490487
type PartitionIterator{T}
491488
c::T

base/pmap.jl

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ Equivalent to `partition(c, max_batch_size)` when `length(c) >> max_batch_size`.
6161
"""
6262
function batchsplit(c; min_batch_count=1, max_batch_size=100)
6363

64-
# FIXME Use @require per https://github.com/JuliaLang/julia/pull/15495
6564
@assert min_batch_count > 0
6665
@assert max_batch_size > 1
6766

test/functional.jl

+14-3
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,19 @@ for n in [5,6]
269269
end
270270

271271

272-
@test_throws AssertionError Base.partition([1,2,3,4,5], 0)
273-
@test_throws AssertionError Base.partition([1,2,3,4,5], -1)
274-
275272
@test join(map(x->string(x...), Base.partition("Hello World!", 5)), "|") ==
276273
"Hello| Worl|d!"
274+
275+
let s = "Monkey 🙈🙊🙊"
276+
tf = (n)->join(map(x->string(x...), Base.partition(s,n)), "|")
277+
@test tf(10) == s
278+
@test tf(9) == "Monkey 🙈🙊|🙊"
279+
@test tf(8) == "Monkey 🙈|🙊🙊"
280+
@test tf(7) == "Monkey |🙈🙊🙊"
281+
@test tf(6) == "Monkey| 🙈🙊🙊"
282+
@test tf(5) == "Monke|y 🙈🙊🙊"
283+
@test tf(4) == "Monk|ey 🙈|🙊🙊"
284+
@test tf(3) == "Mon|key| 🙈🙊|🙊"
285+
@test tf(2) == "Mo|nk|ey| 🙈|🙊🙊"
286+
@test tf(1) == "M|o|n|k|e|y| |🙈|🙊|🙊"
287+
end

0 commit comments

Comments
 (0)