| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013, the Dart project authors. | 2 * Copyright (c) 2013, the Dart project authors. |
| 3 * | 3 * |
| 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
| 5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
| 6 * | 6 * |
| 7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
| 8 * | 8 * |
| 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
| 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 " }", | 80 " }", |
| 81 "}"); | 81 "}"); |
| 82 runProcessor(); | 82 runProcessor(); |
| 83 assertFormattedSource(// | 83 assertFormattedSource(// |
| 84 "class Test {", | 84 "class Test {", |
| 85 " int testA() => JavaFile.separatorChar;", | 85 " int testA() => JavaFile.separatorChar;", |
| 86 " String testB() => JavaFile.separator;", | 86 " String testB() => JavaFile.separator;", |
| 87 "}"); | 87 "}"); |
| 88 } | 88 } |
| 89 | 89 |
| 90 public void test_URI_create() throws Exception { |
| 91 translateSingleFile( |
| 92 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 93 "package test;", |
| 94 "import java.net.URI;", |
| 95 "public class Test {", |
| 96 " public URI test(String uriString) {", |
| 97 " return URI.create(uriString);", |
| 98 " }", |
| 99 "}"); |
| 100 runProcessor(); |
| 101 assertFormattedSource( |
| 102 "class Test {", |
| 103 " Uri test(String uriString) => parseUriWithException(uriString);", |
| 104 "}"); |
| 105 } |
| 106 |
| 90 public void test_URI_new() throws Exception { | 107 public void test_URI_new() throws Exception { |
| 91 translateSingleFile( | 108 translateSingleFile( |
| 92 "// filler filler filler filler filler filler filler filler filler fille
r", | 109 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 93 "package test;", | 110 "package test;", |
| 94 "import java.io.File;", | 111 "import java.io.File;", |
| 95 "import java.net.URI;", | 112 "import java.net.URI;", |
| 96 "public class Test {", | 113 "public class Test {", |
| 97 " public URI newFromPath(String absolutePath) {", | 114 " public URI newFromPath(String absolutePath) {", |
| 98 " URI result = new URI(null, null, absolutePath, null);", | 115 " URI result = new URI(null, null, absolutePath, null);", |
| 99 " return result;", | 116 " return result;", |
| 100 " }", | 117 " }", |
| 118 " public URI newFromStr(String str) {", |
| 119 " return new URI(str);", |
| 120 " }", |
| 101 " public URI newFromFile(File f) {", | 121 " public URI newFromFile(File f) {", |
| 102 " return f.toURI();", | 122 " return f.toURI();", |
| 103 " }", | 123 " }", |
| 104 "}"); | 124 "}"); |
| 105 runProcessor(); | 125 runProcessor(); |
| 106 assertFormattedSource( | 126 assertFormattedSource( |
| 107 "class Test {", | 127 "class Test {", |
| 108 " Uri newFromPath(String absolutePath) {", | 128 " Uri newFromPath(String absolutePath) {", |
| 109 " Uri result = new Uri.fromComponents(path: absolutePath);", | 129 " Uri result = new Uri(path: absolutePath);", |
| 110 " return result;", | 130 " return result;", |
| 111 " }", | 131 " }", |
| 132 " Uri newFromStr(String str) => parseUriWithException(str);", |
| 112 " Uri newFromFile(JavaFile f) => f.toURI();", | 133 " Uri newFromFile(JavaFile f) => f.toURI();", |
| 113 "}"); | 134 "}"); |
| 114 } | 135 } |
| 115 | 136 |
| 116 public void test_URI_properties() throws Exception { | 137 public void test_URI_properties() throws Exception { |
| 117 translateSingleFile( | 138 translateSingleFile( |
| 118 "// filler filler filler filler filler filler filler filler filler fille
r", | 139 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 119 "package test;", | 140 "package test;", |
| 120 "import java.net.URI;", | 141 "import java.net.URI;", |
| 121 "public class Test {", | 142 "public class Test {", |
| (...skipping 15 matching lines...) Expand all Loading... |
| 137 " p.resolveUri(p);", | 158 " p.resolveUri(p);", |
| 138 " p;", | 159 " p;", |
| 139 " }", | 160 " }", |
| 140 "}"); | 161 "}"); |
| 141 } | 162 } |
| 142 | 163 |
| 143 private void runProcessor() { | 164 private void runProcessor() { |
| 144 new IOSemanticProcessor(context).process(unit); | 165 new IOSemanticProcessor(context).process(unit); |
| 145 } | 166 } |
| 146 } | 167 } |
| OLD | NEW |