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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 public void test_update_noCache_entry() { | 244 public void test_update_noCache_entry() { |
245 result = update(null, source, "hello", "hbazlo", 1, 2, 3, entry); | 245 result = update(null, source, "hello", "hbazlo", 1, 2, 3, entry); |
246 assertNotNull(result); | 246 assertNotNull(result); |
247 assertSame(source, result.getSource()); | 247 assertSame(source, result.getSource()); |
248 assertSame(unit, result.getResolvedUnit()); | 248 assertSame(unit, result.getResolvedUnit()); |
249 assertEquals("hello", result.getOldContents()); | 249 assertEquals("hello", result.getOldContents()); |
250 assertEquals("hbazlo", result.getNewContents()); | 250 assertEquals("hbazlo", result.getNewContents()); |
251 assertEquals(1, result.getOffset()); | 251 assertEquals(1, result.getOffset()); |
252 assertEquals(2, result.getOldLength()); | 252 assertEquals(2, result.getOldLength()); |
253 assertEquals(3, result.getNewLength()); | 253 assertEquals(3, result.getNewLength()); |
| 254 assertTrue(result.hasWork()); |
254 } | 255 } |
255 | 256 |
256 public void test_update_noCache_entry_noOldSource_append() { | 257 public void test_update_noCache_entry_noOldSource_append() { |
257 result = update(null, source, null, "hellxo", 4, 0, 1, entry); | 258 result = update(null, source, null, "hellxo", 4, 0, 1, entry); |
258 assertNotNull(result); | 259 assertNotNull(result); |
259 assertSame(source, result.getSource()); | 260 assertSame(source, result.getSource()); |
260 assertSame(unit, result.getResolvedUnit()); | 261 assertSame(unit, result.getResolvedUnit()); |
261 assertEquals("hello", result.getOldContents()); | 262 assertEquals("hello", result.getOldContents()); |
262 assertEquals("hellxo", result.getNewContents()); | 263 assertEquals("hellxo", result.getNewContents()); |
263 assertEquals(4, result.getOffset()); | 264 assertEquals(4, result.getOffset()); |
264 assertEquals(0, result.getOldLength()); | 265 assertEquals(0, result.getOldLength()); |
265 assertEquals(1, result.getNewLength()); | 266 assertEquals(1, result.getNewLength()); |
| 267 assertTrue(result.hasWork()); |
266 } | 268 } |
267 | 269 |
268 public void test_update_noCache_entry_noOldSource_delete() { | 270 public void test_update_noCache_entry_noOldSource_delete() { |
269 result = update(null, source, null, "helo", 4, 1, 0, entry); | 271 result = update(null, source, null, "helo", 4, 1, 0, entry); |
270 assertNull(result); | 272 assertNull(result); |
271 } | 273 } |
272 | 274 |
273 public void test_update_noCache_entry_noOldSource_replace() { | 275 public void test_update_noCache_entry_noOldSource_replace() { |
274 result = update(null, source, null, "helxo", 4, 1, 1, entry); | 276 result = update(null, source, null, "helxo", 4, 1, 1, entry); |
275 assertNull(result); | 277 assertNull(result); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 365 |
364 private CompilationUnit parse(String code) { | 366 private CompilationUnit parse(String code) { |
365 Scanner scanner = new Scanner( | 367 Scanner scanner = new Scanner( |
366 source, | 368 source, |
367 new CharSequenceReader(code), | 369 new CharSequenceReader(code), |
368 AnalysisErrorListener.NULL_LISTENER); | 370 AnalysisErrorListener.NULL_LISTENER); |
369 Parser parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER); | 371 Parser parser = new Parser(source, AnalysisErrorListener.NULL_LISTENER); |
370 return parser.parseCompilationUnit(scanner.tokenize()); | 372 return parser.parseCompilationUnit(scanner.tokenize()); |
371 } | 373 } |
372 } | 374 } |
OLD | NEW |