Skip to content

Commit

Permalink
tests for string.len and string.substr (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
pyroscope committed May 31, 2018
1 parent cb31a2f commit 4c8018c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/commands/string.len.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Tests for "string.len"
$ rtxmlrpc --repr string.len '' -- ''
0
$ rtxmlrpc --repr string.len '' -- 'foo123bar'
9
$ rtxmlrpc --repr string.len '' -- '♯' # TODO: UTF8 support
3
$ rtxmlrpc --repr string.len '' --
ERROR … <Fault -503: 'string.len needs a string argument!'>
15 changes: 15 additions & 0 deletions tests/commands/string.substr.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tests for "string.substr"
$ rtxmlrpc --repr string.substr '' -- 'foo123bar'
'foo123bar'
$ rtxmlrpc --repr string.substr '' -- 'foo123bar' 6
'bar'
$ rtxmlrpc --repr string.substr '' -- 'foo123bar' 3 +3
'123'
$ rtxmlrpc --repr string.substr '' -- 'foo123bar' -6 3
'123'
$ rtxmlrpc --repr string.substr '' -- '➀ ♯'
u'\u2780 \u266f'
$ rtxmlrpc --repr string.substr '' -- '➀ ➁ ➂ ➃ ➄ ➅ ➆ ➇ ➈' 3 2 # TODO: UTF8 support
' ?'
$ rtxmlrpc --repr string.substr '' -- 'for123bar' 3 bad
ERROR …: <Fault -503: 'string.substr(count): junk at end of value: bad'>

0 comments on commit 4c8018c

Please sign in to comment.