Skip to content

Commit 21558a3

Browse files
committed
A few more tests for stringy functions
1 parent 6d3374d commit 21558a3

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

test/testmallocstring.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,15 @@
7777
@test abc == abc[1:3]
7878
@test abc[1:3] == "abc"
7979
free(abc)
80+
81+
# Test other convenience functions
82+
str = m"foobarbaz"
83+
@test contains(str, c"foo")
84+
@test contains(str, c"bar")
85+
@test contains(str, c"baz")
86+
@test startswith(str, c"foo")
87+
@test !startswith(c"foo", str)
88+
@test !startswith(str, c"g")
89+
@test endswith(str, c"baz")
90+
@test !endswith(str, c"bar")
91+
free(str)

test/teststaticstring.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@
6767
@test !startswith(str, c"g")
6868
@test isvalid(c"foo", 1)
6969
@test !isvalid(c"foo", 9999)
70-
@test endswith(c"foobar", c"bar")
71-
@test !endswith(c"foobar", c"baz")
70+
@test endswith(str, c"baz")
71+
@test !endswith(str, c"bar")
7272
@test isvalid(c"α", 1)
7373
@test !isvalid(c"α", 2)
7474
@test thisind(c"α", 2) == 1

0 commit comments

Comments
 (0)