From 3906bb99687061a42435dae385ebdf84f82e31df Mon Sep 17 00:00:00 2001 From: James Roseborough Date: Wed, 4 Jun 2008 15:33:21 +0000 Subject: [PATCH] Add tests for some uncovered functions. --- src/test/res/strlib.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/test/res/strlib.lua b/src/test/res/strlib.lua index b2951955..7720cd49 100644 --- a/src/test/res/strlib.lua +++ b/src/test/res/strlib.lua @@ -77,3 +77,17 @@ print(string.len("\0\1\2\3")) print(#"\0\1\2\3") local s = "\194\161Hola!" print(s, string.len(s), #s) + +local function strtests(name,func,...) + print(name, 'good', pcall( func, ... ) ) + print(name, 'empty', pcall( func ) ) + print(name, 'table', pcall( func, {} ) ) + print(name, 'nil', pcall( func, nil ) ) +end + +strtests('lower', string.lower, s ) +strtests('upper', string.upper, s ) +strtests('reverse', string.reverse, s ) +strtests('char', string.char, 92, 60, 61, 93 ) +strtests('dump', string.dump, function() print('hello, world') end ) +