diff options
author | Stéphane Cerveau <scerveau@collabora.com> | 2020-07-09 12:34:34 +0200 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2020-07-20 20:04:01 -0400 |
commit | 8f106a2b9a7824075e55d3f044f2c0c5dd3ee700 (patch) | |
tree | 95d4b7f319fb62f1321b5a15af91bb0e48e55a9a /test cases/common | |
parent | 804a71e8f2b7c1011c91bd016df435fc952677a0 (diff) | |
download | meson-8f106a2b9a7824075e55d3f044f2c0c5dd3ee700.zip meson-8f106a2b9a7824075e55d3f044f2c0c5dd3ee700.tar.gz meson-8f106a2b9a7824075e55d3f044f2c0c5dd3ee700.tar.bz2 |
string: add substring method
This method aims to offer a simple way to 'substring'
an existing string with start and end values.
Diffstat (limited to 'test cases/common')
-rw-r--r-- | test cases/common/38 string operations/meson.build | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test cases/common/38 string operations/meson.build b/test cases/common/38 string operations/meson.build index 6596142..8a06a82 100644 --- a/test cases/common/38 string operations/meson.build +++ b/test cases/common/38 string operations/meson.build @@ -101,3 +101,18 @@ assert('\\\\n' == bs_bs_n, 'Four backslash broken before n') assert('\\\\\n' == bs_bs_nl, 'Five backslash broken before n') assert('\\\\' == bs_bs, 'Double-backslash broken') assert('\\' == bs, 'Backslash broken') + +mysubstring='foobarbaz' +assert(mysubstring.substring() == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(0) == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(1) == 'oobarbaz', 'substring is broken') +assert(mysubstring.substring(-5) == 'arbaz', 'substring is broken') +assert(mysubstring.substring(1, 4) == 'oob', 'substring is broken') +assert(mysubstring.substring(1,-5) == 'oob', 'substring is broken') +assert(mysubstring.substring(1, 0) == '', 'substring is broken') +assert(mysubstring.substring(0, 100) == 'foobarbaz', 'substring is broken') +assert(mysubstring.substring(-1, -5) == '', 'substring is broken') +assert(mysubstring.substring(10, -25) == '', 'substring is broken') +assert(mysubstring.substring(-4, 2) == '', 'substring is broken') +assert(mysubstring.substring(10, 9) == '', 'substring is broken') +assert(mysubstring.substring(8, 10) == 'z', 'substring is broken') |