Improve error reporting.

This commit is contained in:
James Roseborough
2010-05-12 04:46:58 +00:00
parent 282140040e
commit 38acf6a75e
6 changed files with 57 additions and 45 deletions

View File

@@ -66,6 +66,16 @@ public class StringTest extends TestCase {
}
return sb.toString();
}
public void testUtf820482051() throws UnsupportedEncodingException {
int i = 2048;
char[] c = { (char) (i+0), (char) (i+1), (char) (i+2), (char) (i+3) };
String before = new String(c)+" "+i+"-"+(i+4);
LuaString ls = LuaString.valueOf(before);
String after = ls.tojstring();
assertEquals( userFriendly( before ), userFriendly( after ) );
}
public void testUtf8() {
for ( int i=4; i<0xffff; i+=4 ) {
@@ -101,7 +111,7 @@ public class StringTest extends TestCase {
String before = new String(c);
LuaString ls = LuaString.valueOf(before);
String after = ls.tojstring();
assertEquals( userFriendly( "abc" ), userFriendly( after ) );
assertEquals( userFriendly( "abc\0def" ), userFriendly( after ) );
}
}

View File

@@ -9,7 +9,7 @@ require 'args'
banner('unary -')
negative = function(a) return - a end
checkallpass('negative',{somenumber})
checkallerrors('negative',{notanumber},'attempt to perform arithmetic on')
checkallerrors('negative',{notanumber},'attempt to perform arithmetic')
-- length
banner('#')
@@ -21,7 +21,7 @@ checkallerrors('lengthop',{notatable},'attempt to get length of')
banner('not')
notop = function(a) return not a end
checkallpass('notop',{somenumber})
checkallerrors('notop',{notanumber},'attempt to perform arithmetic on')
checkallpass('notop',{notanumber})
-- function call
banner( '()' )