test(lua): add tests for format object

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-11-11 12:58:28 -08:00
parent c2db18a003
commit b227775a07
2 changed files with 11 additions and 1 deletions

View file

@ -103,7 +103,7 @@ static int format_highlight(lua_State * L) {
} else if (strcmp(color_str, "grey") == 0) {
color = format::GREY;
} else {
return luaL_error(L, "unknown color '%'", color_str);
return luaL_error(L, "unknown color '%s'", color_str);
}
return push_format(L, highlight(to_format(L, 1), color));
}

10
tests/lua/format3.lua Normal file
View file

@ -0,0 +1,10 @@
print(format("hello"):highlight("green"))
print(format("hello"):highlight("orange"))
print(format("hello"):highlight("blue"))
print(format("hello"):highlight("cyan"))
print(format("hello"):highlight("grey"))
print(format("hello"):highlight("red"))
check_error(function() print(format("hello"):highlight("xyz")) end)
print(format())
print(format(mpz(10)))
print(format(mpq(10)/3))