Hi,
perhaps we should add some Unit tests (via [1]) to Trinidad,
to test stuff like our converters:
import junit.framework.TestCase;
import net.sf.jstester.JsTester;
public class MyTestCase extends TestCase {
private JsTester jsTester;
protected void setUp() throws Exception {
jsTester = new JsTester();
// initialize the tester
jsTester.onSetUp();
jsTester.eval( jsTester.loadScript("Locale.js"));
jsTester.eval( jsTester.loadScript("CoreFormat.js") );
}
public void testInlineJs(){
jsTester.eval("var converter = new TrNumberConverter(null,
'percent', null, null);");
jsTester.assertNotNull("converter");
jsTester.eval("var converted = converter.getAsString(0.54, null);");
jsTester.eval("var value ='54%'");
jsTester.assertEquals("value", "converted");
}
@Override
protected void tearDown() throws Exception {
// cleanup, don't forget!
jsTester.onTearDown();
}
}
-Matthias
[1] http://jstester.sourceforge.net/
--
Matthias Wessendorf
further stuff:
blog: http://matthiaswessendorf.wordpress.com/
mail: matzew-at-apache-dot-org