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

Side by Side Diff: test/file_message_test.dart

Issue 1028813002: Introduce span with line context (Closed) Base URL: git@github.com:dart-lang/source_span.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:unittest/unittest.dart'; 5 import 'package:unittest/unittest.dart';
6 import 'package:source_span/source_span.dart'; 6 import 'package:source_span/source_span.dart';
7 import 'package:source_span/src/colors.dart' as colors; 7 import 'package:source_span/src/colors.dart' as colors;
8 8
9 main() { 9 main() {
10 var file; 10 var file;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 test("works for a point span at the end of the file", () { 55 test("works for a point span at the end of the file", () {
56 expect(file.location(38).pointSpan().message("oh no"), equals(""" 56 expect(file.location(38).pointSpan().message("oh no"), equals("""
57 line 3, column 12 of foo.dart: oh no 57 line 3, column 12 of foo.dart: oh no
58 zip zap zop 58 zip zap zop
59 ^""")); 59 ^"""));
60 }); 60 });
61 61
62 test("works for a point span in an empty file", () { 62 test("works for a point span in an empty file", () {
63 expect(new SourceFile("").location(0).pointSpan().message("oh no"), 63 expect(new SourceFile("").location(0).pointSpan().message("oh no"),
64 equals(""" 64 equals("""
65 line 1, column 1: oh no 65 line 1, column 1: oh no"""));
66
67 ^"""));
Siggi Cherem (dart-lang) 2015/03/21 00:19:59 would you consider this a breaking change? I cou
nweiz 2015/03/24 23:01:17 No, I don't consider the specific format of [messa
Siggi Cherem (dart-lang) 2015/03/25 00:33:25 Turns out the fix for this was much easier than I
68 }); 66 });
69 67
70 test("works for a single-line file without a newline", () { 68 test("works for a single-line file without a newline", () {
71 expect(new SourceFile("foo bar").span(0, 7).message("oh no"), 69 expect(new SourceFile("foo bar").span(0, 7).message("oh no"),
72 equals(""" 70 equals("""
73 line 1, column 1: oh no 71 line 1, column 1: oh no
74 foo bar 72 foo bar
75 ^^^^^^^""")); 73 ^^^^^^^"""));
76 }); 74 });
77 75
(...skipping 13 matching lines...) Expand all
91 }); 89 });
92 90
93 test("uses the given color if it's passed", () { 91 test("uses the given color if it's passed", () {
94 expect(file.span(4, 7).message("oh no", color: colors.YELLOW), equals(""" 92 expect(file.span(4, 7).message("oh no", color: colors.YELLOW), equals("""
95 line 1, column 5 of foo.dart: oh no 93 line 1, column 5 of foo.dart: oh no
96 foo ${colors.YELLOW}bar${colors.NONE} baz 94 foo ${colors.YELLOW}bar${colors.NONE} baz
97 ${colors.YELLOW}^^^${colors.NONE}""")); 95 ${colors.YELLOW}^^^${colors.NONE}"""));
98 }); 96 });
99 }); 97 });
100 } 98 }
OLDNEW
« lib/src/span_mixin.dart ('K') | « pubspec.yaml ('k') | test/span_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698