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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 857283003: Addition of the new flag "file-read-mode" into the analysis server to fix the offset bug with Intel… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Comments addressed Created 5 years, 11 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
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index 5852a91ffe6b1a0e3457a1e70af6695cec4b59e2..3c1f95b3b68fc17aa634c543f311ba68ad079a87 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -9,6 +9,7 @@ library engine.all_the_rest_test;
import 'dart:collection';
+import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator;
import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/element.dart';
@@ -7384,6 +7385,48 @@ class FileBasedSourceTest {
expect(source.shortName, "exist.dart");
}
+ void test_fileReadMode() {
+ expect(FileBasedSource.fileReadMode('a'), 'a');
+ expect(FileBasedSource.fileReadMode('a\n'), 'a\n');
+ expect(FileBasedSource.fileReadMode('ab'), 'ab');
+ expect(FileBasedSource.fileReadMode('abc'), 'abc');
+ expect(FileBasedSource.fileReadMode('a\nb'), 'a\nb');
+ expect(FileBasedSource.fileReadMode('a\rb'), 'a\rb');
+ expect(FileBasedSource.fileReadMode('a\r\nb'), 'a\r\nb');
+ }
+
+ void test_fileReadMode_changed() {
+ FileBasedSource.fileReadMode = (String s) => s + 'xyz';
+ expect(FileBasedSource.fileReadMode('a'), 'axyz');
+ expect(FileBasedSource.fileReadMode('a\n'), 'a\nxyz');
+ expect(FileBasedSource.fileReadMode('ab'), 'abxyz');
+ expect(FileBasedSource.fileReadMode('abc'), 'abcxyz');
+ FileBasedSource.fileReadMode = (String s) => s;
+ }
+
+ void test_fileReadMode_normalize_eol_always() {
+ FileBasedSource.fileReadMode =
+ PhysicalResourceProvider.NORMALIZE_EOL_ALWAYS;
+ expect(FileBasedSource.fileReadMode('a'), 'a');
+
+ // '\n' -> '\n' as first, last and only character
+ expect(FileBasedSource.fileReadMode('\n'), '\n');
+ expect(FileBasedSource.fileReadMode('a\n'), 'a\n');
+ expect(FileBasedSource.fileReadMode('\na'), '\na');
+
+ // '\r\n' -> '\n' as first, last and only character
+ expect(FileBasedSource.fileReadMode('\r\n'), '\n');
+ expect(FileBasedSource.fileReadMode('a\r\n'), 'a\n');
+ expect(FileBasedSource.fileReadMode('\r\na'), '\na');
+
+ // '\r' -> '\n' as first, last and only character
+ expect(FileBasedSource.fileReadMode('\r'), '\n');
+ expect(FileBasedSource.fileReadMode('a\r'), 'a\n');
+ expect(FileBasedSource.fileReadMode('\ra'), '\na');
+
+ FileBasedSource.fileReadMode = (String s) => s;
+ }
+
void test_hashCode() {
JavaFile file1 = FileUtilities2.createFile("/does/not/exist.dart");
JavaFile file2 = FileUtilities2.createFile("/does/not/exist.dart");
« no previous file with comments | « pkg/analyzer/lib/src/generated/source_io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698