summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2023-01-18 14:13:13 +0100
committerRico Tzschichholz <ricotz@ubuntu.com>2023-01-18 14:13:13 +0100
commiteb38c29d8f163792be026f46e46c0f86f719d14e (patch)
treea0d579cf449eb111d78fcfb1df28aa498612dda7 /tests
parent58dcad084f427585994ab66904436e1bd0e0b2a1 (diff)
downloadvala-eb38c29d8f163792be026f46e46c0f86f719d14e.tar.gz
tests: Extend string.replace() test to increase coverage
Diffstat (limited to 'tests')
-rw-r--r--tests/basic-types/strings.c-expected14
-rw-r--r--tests/basic-types/strings.vala6
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/basic-types/strings.c-expected b/tests/basic-types/strings.c-expected
index f060dd0fe..4bf10a989 100644
--- a/tests/basic-types/strings.c-expected
+++ b/tests/basic-types/strings.c-expected
@@ -581,6 +581,10 @@ test_string_replace (void)
const gchar* _tmp1_;
gchar* _tmp2_;
const gchar* _tmp3_;
+ gchar* _tmp4_;
+ const gchar* _tmp5_;
+ gchar* _tmp6_;
+ const gchar* _tmp7_;
_tmp0_ = g_strdup ("hellomyworld");
s = _tmp0_;
_tmp1_ = s;
@@ -589,6 +593,16 @@ test_string_replace (void)
s = _tmp2_;
_tmp3_ = s;
_vala_assert (g_strcmp0 (_tmp3_, "hellowholeworld") == 0, "s == \"hellowholeworld\"");
+ _tmp4_ = string_replace ("Γειά σου Κόσμε", "Γειά σου ", "");
+ _g_free0 (s);
+ s = _tmp4_;
+ _tmp5_ = s;
+ _vala_assert (g_strcmp0 (_tmp5_, "Κόσμε") == 0, "s == \"\316\232\317\214\317\203\316\274\316\265\"");
+ _tmp6_ = string_replace ("こんにちは世界", "世界", "");
+ _g_free0 (s);
+ s = _tmp6_;
+ _tmp7_ = s;
+ _vala_assert (g_strcmp0 (_tmp7_, "こんにちは") == 0, "s == \"\343\201\223\343\202\223\343\201\253\343\201\241\343\201\257\"");
_g_free0 (s);
}
diff --git a/tests/basic-types/strings.vala b/tests/basic-types/strings.vala
index 31eab55dd..59db047d6 100644
--- a/tests/basic-types/strings.vala
+++ b/tests/basic-types/strings.vala
@@ -83,6 +83,12 @@ void test_string_replace () {
s = s.replace ("my", "whole");
assert (s == "hellowholeworld");
+
+ s = "Γειά σου Κόσμε".replace ("Γειά σου ", "");
+ assert (s == "Κόσμε");
+
+ s = "こんにちは世界".replace ("世界", "");
+ assert (s == "こんにちは");
}
void test_string_slice () {