Add more null scenarios to StringTest.
@@ -124,6 +124,13 @@ public class StringTest extends GWTTestCase {
} catch (NullPointerException e) {
// expected
}
+
+ try {
+ "".compareTo(returnNull());
+ fail();
+ } catch (NullPointerException e) {
+ // expected
+ }
}
public void testConcat() {
@@ -859,6 +866,16 @@ public class StringTest extends GWTTestCase {
assertSame("s same as s.toString()", s, s.toString());
}
+ @Wasm("nop") // TODO(b/183769034): Re-enable when NPE on dereference is supported
+ public static void testToStringNull() {
+ try {
+ returnNull().toString();
+ fail();
+ } catch (NullPointerException e) {
+ // expected
+ }
+ }
+
/*
* TODO: needs rewriting to avoid compiler optimizations.
*/
