diff options
author | David Smith <dsmith@redhat.com> | 2009-06-18 10:12:35 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-06-18 10:12:35 -0500 |
commit | 36b8245df8de0092c5d28765b1ae7d9d8050da6e (patch) | |
tree | 099aa846e65490af10a6b925f566a3068c2984d7 /testsuite/systemtap.string/tokenize.stp | |
parent | 9eebc06b5e24480c7b6055a8b6f1c07512f293fb (diff) | |
parent | 0e5cd254d3ef39cef5fa6ba56231604274fd85cd (diff) | |
download | systemtap-steved-36b8245df8de0092c5d28765b1ae7d9d8050da6e.tar.gz systemtap-steved-36b8245df8de0092c5d28765b1ae7d9d8050da6e.tar.xz systemtap-steved-36b8245df8de0092c5d28765b1ae7d9d8050da6e.zip |
Merge commit 'origin/master' into pr7043
Diffstat (limited to 'testsuite/systemtap.string/tokenize.stp')
-rw-r--r-- | testsuite/systemtap.string/tokenize.stp | 54 |
1 files changed, 19 insertions, 35 deletions
diff --git a/testsuite/systemtap.string/tokenize.stp b/testsuite/systemtap.string/tokenize.stp index 10703d90..ba95f63f 100644 --- a/testsuite/systemtap.string/tokenize.stp +++ b/testsuite/systemtap.string/tokenize.stp @@ -1,3 +1,14 @@ +function tokprint(str, delim) +{ + println("-") + + tok = tokenize(str, delim) + while (tok != "") { + println(tok) + tok = tokenize("", delim) + } +} + probe begin { teststr1 = "one|two|three|four|five|six|seven|eight|nine|ten" @@ -5,42 +16,15 @@ probe begin teststr3 = "1,,2,3, ,4" teststr4 = "" teststr5 = "this is a string with no delimiters" + teststr6 = "this is a string, which has two delimiters" - tok = tokenize(teststr1, "|") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", "|") - } - - tok = tokenize(teststr1, ",") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", "|") - } - - tok = tokenize(teststr2, ",") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", ",") - } - - tok = tokenize(teststr3, ",") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", ",") - } - - tok = tokenize(teststr4, ",") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", ",") - } - - tok = tokenize(teststr5, ",") - while (tok != "") { - printf("%s\n", tok) - tok = tokenize("", ",") - } + tokprint(teststr1, "|") + tokprint(teststr1, ",") + tokprint(teststr2, ",") + tokprint(teststr3, ",") + tokprint(teststr4, ",") + tokprint(teststr5, ",") + tokprint(teststr6, ", ") exit() } |