From f54cc239a5f90fd6a338f140a2a63a465540dd6b Mon Sep 17 00:00:00 2001 From: kichikuou Date: Sat, 13 Feb 2021 17:44:12 +0900 Subject: [PATCH] Add tests for #8 --- test/Source/strings.jaf | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/Source/strings.jaf b/test/Source/strings.jaf index 1cc6319..b7aef4e 100755 --- a/test/Source/strings.jaf +++ b/test/Source/strings.jaf @@ -95,9 +95,19 @@ void test_strings(void) test_bool("(4.222).String(2)", (f = 4.222, f.String(2) == "4.22"), true); // C_REF test_equal("abあいう[3]", (s = "abあいう", s[3]), 'い'); + test_equal("abc[3]", (s = "abc", s[3]), 0); + test_equal("abあいう[5]", (s = "abあいう", s[5]), 0); + test_equal("abあいう[8]", (s = "abあいう", s[8]), 0); + // This throws + // test_equal("abあいう[9]", (s = "abあいう", s[9]), 0); + // C_ASSIGN test_string("abあいう[1] = 'c'", (s = "abあいう", s[1] = 'c', s), "acあいう"); test_string("abあいう[3] = 'あ'", (s = "abあいう", s[3] = 'あ', s), "abああう"); test_string("abあいう[1] = 'あ'", (s = "abあいう", s[1] = 'あ', s), "aああいう"); test_string("abあいう[3] = 'c'", (s = "abあいう", s[3] = 'c', s), "abあcう"); + test_string("abあいう[5] = 'c'", (s = "abあいう", s[5] = 'c', s), "abあいう"); + test_string("abあいう[7] = 'c'", (s = "abあいう", s[7] = 'c', s), "abあいう"); + // This throws + // test_string("abあいう[8] = 'c'", (s = "abあいう", s[8] = 'c', s), "abあいう"); }