From: fennecdjay Date: Thu, 5 Nov 2020 17:00:04 +0000 (+0100) Subject: :white_check_mark: Some string tests X-Git-Tag: nightly~1207 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=03a338768d748fb182e907c587aacad8225c5a8e;p=gwion.git :white_check_mark: Some string tests --- diff --git a/src/lib/string.c b/src/lib/string.c index 98422c1f..b87a31d2 100644 --- a/src/lib/string.c +++ b/src/lib/string.c @@ -483,11 +483,11 @@ GWION_IMPORT(string) { gwi_func_ini(gwi, "string", "trim"); GWI_BB(gwi_func_end(gwi, string_trim, ae_flag_none)) - gwi_func_ini(gwi, "int", "charAt"); + gwi_func_ini(gwi, "char", "charAt"); gwi_func_arg(gwi, "int", "pos"); GWI_BB(gwi_func_end(gwi, string_charAt, ae_flag_none)) - gwi_func_ini(gwi, "int", "charAt"); + gwi_func_ini(gwi, "char", "charAt"); gwi_func_arg(gwi, "int", "pos"); gwi_func_arg(gwi, "char", "c"); GWI_BB(gwi_func_end(gwi, string_setCharAt, ae_flag_none)) diff --git a/tests/string/charAt.gw b/tests/string/charAt.gw new file mode 100644 index 00000000..93eb65ab --- /dev/null +++ b/tests/string/charAt.gw @@ -0,0 +1,7 @@ +<<< "".charAt(-1) >>>; +<<< "".charAt(2) >>>; +<<< " test String ".charAt(2) >>>; + +<<< "test".charAt(-1, 'c') >>>; +<<< "test".charAt(12, 'c') >>>; +<<< "test".charAt(2, 'c') >>>; diff --git a/tests/string/eq.gw b/tests/string/eq.gw index 14ace808..f2b95b86 100644 --- a/tests/string/eq.gw +++ b/tests/string/eq.gw @@ -6,3 +6,12 @@ <<< s0 != s0 >>>; <<< s0 != s1 >>>; + +<<< null == s0 >>>; +<<< null != s0 >>>; + +<<< s0 == null >>>; +<<< s0 != null >>>; + +<<< null == null >>>; +<<< null != null >>>; diff --git a/tests/string/lower.gw b/tests/string/lower.gw new file mode 100644 index 00000000..9336a2bf --- /dev/null +++ b/tests/string/lower.gw @@ -0,0 +1 @@ +<<< "Test String".lower() >>>; diff --git a/tests/string/ltrim.gw b/tests/string/ltrim.gw new file mode 100644 index 00000000..937fcb12 --- /dev/null +++ b/tests/string/ltrim.gw @@ -0,0 +1,2 @@ +<<< "".ltrim() >>>; +<<< " test String ".ltrim() >>>; diff --git a/tests/string/rtrim.gw b/tests/string/rtrim.gw new file mode 100644 index 00000000..cf0645c0 --- /dev/null +++ b/tests/string/rtrim.gw @@ -0,0 +1,2 @@ +<<< "".rtrim() >>>; +<<< " test String ".rtrim() >>>; diff --git a/tests/string/size.gw b/tests/string/size.gw new file mode 100644 index 00000000..3f7539a9 --- /dev/null +++ b/tests/string/size.gw @@ -0,0 +1 @@ +<<< "test".size() >>>; diff --git a/tests/string/trim.gw b/tests/string/trim.gw new file mode 100644 index 00000000..32adde6e --- /dev/null +++ b/tests/string/trim.gw @@ -0,0 +1,2 @@ +<<< "".trim() >>>; +<<< " test String ".trim() >>>; diff --git a/tests/string/upper.gw b/tests/string/upper.gw new file mode 100644 index 00000000..f8081c9b --- /dev/null +++ b/tests/string/upper.gw @@ -0,0 +1 @@ +<<< "test String".upper() >>>;