|
82 | 82 |
|
83 | 83 | @test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8 |
84 | 84 |
|
85 | | -# 0.7.0-DEV.3415 |
86 | | -for (f1, f2, i) in ((Compat.findfirst, Compat.findnext, 1), |
87 | | - (Compat.findlast, Compat.findprev, 2)) |
88 | | - # Generic methods |
89 | | - @test f1(isequal(0), [1, 0]) == f2(isequal(0), [1, 0], i) == 2 |
90 | | - @test f1(isequal(9), [1, 0]) == f2(isequal(9), [1, 0], i) == nothing |
91 | | - @test f1(in([0, 2]), [1, 0]) == f2(in([0, 2]), [1, 0], i) == 2 |
92 | | - @test f1(in([0, 2]), [1, 9]) == f2(in([0, 2]), [1, 9], i) == nothing |
93 | | - if VERSION < v"0.7.0-DEV.4592" |
94 | | - # test that occursin work on 0.6 |
95 | | - @test f1(occursin([0, 2]), [1, 0]) == f2(occursin([0, 2]), [1, 0], i) == 2 |
96 | | - @test f1(occursin([0, 2]), [1, 9]) == f2(occursin([0, 2]), [1, 9], i) == nothing |
97 | | - end |
98 | | - @test f1([true, false]) == f2([true, false], i) == 1 |
99 | | - @test f1([false, false]) == f2([false, false], i) == nothing |
100 | | - |
101 | | - # Specific methods |
102 | | - @test f2(isequal('a'), "ba", i) == f1(isequal('a'), "ba") == 2 |
103 | | - for S in (Int8, UInt8), T in (Int8, UInt8) |
104 | | - # Bug in Julia 0.6 |
105 | | - f1 === Compat.findlast && VERSION < v"0.7.0-DEV.3272" && continue |
106 | | - @test f2(isequal(S(1)), T[0, 1], i) == f1(isequal(S(1)), T[0, 1]) == 2 |
107 | | - @test f2(isequal(S(9)), T[0, 1], i) == f1(isequal(S(9)), T[0, 1]) == nothing |
108 | | - end |
109 | | - for chars in (['a', 'z'], Set(['a', 'z']), ('a', 'z')) |
110 | | - @test f2(in(chars), "ba", i) == f1(in(chars), "ba") == 2 |
111 | | - @test f2(in(chars), "bx", i) == f1(in(chars), "bx") == nothing |
112 | | - if VERSION < v"0.7.0-DEV.4592" |
113 | | - # test that occursin work on 0.6 |
114 | | - @test f2(occursin(chars), "ba", i) == f1(occursin(chars), "ba") == 2 |
115 | | - @test f2(occursin(chars), "bx", i) == f1(occursin(chars), "bx") == nothing |
116 | | - end |
117 | | - end |
118 | | -end |
119 | | -@test findnext("a", "ba", 1) == findfirst("a", "ba") == 2:2 |
120 | | -@test findnext("z", "ba", 1) == findfirst("z", "ba") == (VERSION < v"0.7.0-DEV.4480" ? (0:-1) : nothing) |
121 | | -@test findprev("a", "ba", 2) == findlast("a", "ba") == 2:2 |
122 | | -@test findprev("z", "ba", 2) == findlast("z", "ba") == (VERSION < v"0.7.0-DEV.4480" ? (0:-1) : nothing) |
123 | | -@test Compat.findnext("a", "ba", 1) == Compat.findfirst("a", "ba") == 2:2 |
124 | | -@test Compat.findnext("z", "ba", 1) == Compat.findfirst("z", "ba") == nothing |
125 | | -@test Compat.findprev("a", "ba", 2) == Compat.findlast("a", "ba") == 2:2 |
126 | | -@test Compat.findprev("z", "ba", 2) == Compat.findlast("z", "ba") == nothing |
127 | | - |
128 | | -@test findnext(r"a", "ba", 1) == findfirst(r"a", "ba") == 2:2 |
129 | | -@test findnext(r"z", "ba", 1) == findfirst(r"z", "ba") == (VERSION < v"0.7.0-DEV.4480" ? (0:-1) : nothing) |
130 | | -@test Compat.findnext(r"a", "ba", 1) == Compat.findfirst(r"a", "ba") == 2:2 |
131 | | -@test Compat.findnext(r"z", "ba", 1) == Compat.findfirst(r"z", "ba") == nothing |
132 | | - |
133 | 85 | @test findall([true, false, true]) == [1, 3] |
134 | 86 | @test findall(in([1, 2]), [1]) == [1] |
135 | 87 | if VERSION < v"0.7.0-DEV.4592" |
|
0 commit comments