Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2111)

Unified Diff: editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java

Issue 16103010: Fixes for translator and DDA status files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java
diff --git a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java
index af7b79f98fb31f8ea426b3d16db6c817d7b588c7..4d0da8e8d9c7da51903ef39b146b2cc52aa0e53a 100644
--- a/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java
+++ b/editor/util/plugins/com.google.dart.java2dart_test/src/com/google/dart/java2dart/processor/ObjectSemanticProcessorTest.java
@@ -132,6 +132,26 @@ public class ObjectSemanticProcessorTest extends SemanticProcessorTest {
"}");
}
+ public void test_double_castTo_int() throws Exception {
+ translateSingleFile(
+ "// filler filler filler filler filler filler filler filler filler filler",
+ "package test;",
+ "public class Test {",
+ " public int testA(double p) {",
+ " return (int) p;",
+ " }",
+ " public long testB(double p) {",
+ " return (long) p;",
+ " }",
+ "}");
+ runProcessor();
+ assertFormattedSource(
+ "class Test {",
+ " int testA(double p) => p.toInt();",
+ " int testB(double p) => p.toInt();",
+ "}");
+ }
+
public void test_Double_parseDouble() throws Exception {
translateSingleFile(
"// filler filler filler filler filler filler filler filler filler filler",
@@ -309,7 +329,11 @@ public class ObjectSemanticProcessorTest extends SemanticProcessorTest {
"package test;",
"public class Test {",
" public int test(String p) {",
- " return Integer.parseInt(p);",
+ " try {",
+ " return Integer.parseInt(p);",
+ " } catch (NumberFormatException e) {",
+ " return 0;",
+ " }",
" }",
" public int testX(String p) {",
" return Integer.parseInt(p, 16);",
@@ -318,7 +342,13 @@ public class ObjectSemanticProcessorTest extends SemanticProcessorTest {
runProcessor();
assertFormattedSource(
"class Test {",
- " int test(String p) => int.parse(p);",
+ " int test(String p) {",
+ " try {",
+ " return int.parse(p);",
+ " } on FormatException catch (e) {",
+ " return 0;",
+ " }",
+ " }",
" int testX(String p) => int.parse(p, radix: 16);",
"}");
}
@@ -778,6 +808,8 @@ public class ObjectSemanticProcessorTest extends SemanticProcessorTest {
" public void main(String s) {",
" s.indexOf('1');",
" s.indexOf('2', 42);",
+ " s.lastIndexOf('1');",
+ " s.lastIndexOf('2', 42);",
" }",
"}");
runProcessor();
@@ -786,6 +818,8 @@ public class ObjectSemanticProcessorTest extends SemanticProcessorTest {
" void main(String s) {",
" s.indexOf('1');",
" s.indexOf('2', 42);",
+ " s.lastIndexOf('1');",
+ " s.lastIndexOf('2', 42);",
" }",
"}");
}

Powered by Google App Engine
This is Rietveld 408576698