diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2021-08-13 17:03:19 -0400 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2021-08-13 17:03:19 -0400 |
commit | bcc0594e9b64c89b56e8ea6891c0a9f8b97c57d1 (patch) | |
tree | a9b1274d4c91673b6da697f31d82177b16538913 /test/regexsub.ok | |
parent | 492c24d65f760edea1f9228260930728eb747cf7 (diff) | |
download | egawk-bcc0594e9b64c89b56e8ea6891c0a9f8b97c57d1.tar.gz egawk-bcc0594e9b64c89b56e8ea6891c0a9f8b97c57d1.tar.bz2 egawk-bcc0594e9b64c89b56e8ea6891c0a9f8b97c57d1.zip |
Rationalize strong regex as param to sub/gsub. Add tests.
Diffstat (limited to 'test/regexsub.ok')
-rw-r--r-- | test/regexsub.ok | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/regexsub.ok b/test/regexsub.ok new file mode 100644 index 00000000..44511ebc --- /dev/null +++ b/test/regexsub.ok @@ -0,0 +1,30 @@ +Initialize strong regex +Test gsub on strong regex +rgx1 = '[abc]' typeof(rgx1) = 'regexp' +rgx2 = '[abc]' typeof(rgx2) = 'regexp' +Test gsub() a strong regex +rgx1 = '[abc]' typeof(rgx1) = 'regexp' +rgx2 = '[aec]' typeof(rgx2) = 'regexp' +Test value not found in regex +rgx1 = '[abc]' typeof(rgx1) = 'regexp' +Test gsub on numbers +v1 = '12345' typeof(v1) = 'number' +v2 = '12345' typeof(v2) = 'number' +v1 = '12345' typeof(v1) = 'number' +v2 = '12x45' typeof(v2) = 'string' +Test value not found in number +v1 = '12345' typeof(v1) = 'number' +Test gensub on regex +a = @/abc/ typeof(a) = 'regexp' +c = "axc" typeof(c) = 'string' +Test value not found in regex +b = @/abc/ typeof(b) = 'regexp' +c = "abc" typeof(c) = 'string' +Test gensub on numbers +a = "12345" typeof(a) = 'number' +b = "12345" typeof(b) = 'number' +c = "12x45" typeof(c) = 'string' +Test value not found in number +b = "12345" typeof(b) = 'number' +c = "12345" typeof(c) = 'string' +string 12345 |