Skip to content

Commit 7edabc9

Browse files
kevmoonex3
authored andcommitted
Enable Travis-CI (flutter#7)
Fixes flutter#6
1 parent 005fab6 commit 7edabc9

9 files changed

+45
-20
lines changed

.travis.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
language: dart
2+
3+
dart:
4+
- dev
5+
- stable
6+
7+
dart_task:
8+
- test: --platform vm,chrome
9+
10+
matrix:
11+
include:
12+
# Only validate formatting using the dev release
13+
- dart: dev
14+
dart_task: dartfmt
15+
- dart: dev
16+
dart_task: analyzer
17+
18+
# Only building master means that we don't run two builds for each pull request.
19+
branches:
20+
only: [master]
21+
22+
cache:
23+
directories:
24+
- $HOME/.pub-cache
File renamed without changes.

lib/src/eager_span_scanner.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ class EagerSpanScanner extends SpanScanner {
5858
if (newlines.isEmpty) {
5959
_column -= oldPosition - newPosition;
6060
} else {
61-
_column = newPosition -
62-
string.lastIndexOf(_newlineRegExp, newPosition) - 1;
61+
_column =
62+
newPosition - string.lastIndexOf(_newlineRegExp, newPosition) - 1;
6363
}
6464
}
6565
}
@@ -121,4 +121,3 @@ class _EagerSpanScannerState implements LineScannerState {
121121

122122
_EagerSpanScannerState(this._scanner, this.position, this.line, this.column);
123123
}
124-

lib/src/line_scanner.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class LineScanner extends StringScanner {
6666
if (newlines.isEmpty) {
6767
_column -= oldPosition - newPosition;
6868
} else {
69-
_column = newPosition -
70-
string.lastIndexOf(_newlineRegExp, newPosition) - 1;
69+
_column =
70+
newPosition - string.lastIndexOf(_newlineRegExp, newPosition) - 1;
7171
}
7272
}
7373
}

lib/src/relative_span_scanner.dart

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
2727
/// This is used to convert between span-relative and file-relative fields.
2828
final FileLocation _startLocation;
2929

30-
int get line => _sourceFile.getLine(_startLocation.offset + position) -
30+
int get line =>
31+
_sourceFile.getLine(_startLocation.offset + position) -
3132
_startLocation.line;
3233

3334
int get column {
3435
var line = _sourceFile.getLine(_startLocation.offset + position);
35-
var column = _sourceFile.getColumn(_startLocation.offset + position,
36-
line: line);
36+
var column =
37+
_sourceFile.getColumn(_startLocation.offset + position, line: line);
3738
return line == _startLocation.line
3839
? column - _startLocation.column
3940
: column;
@@ -66,8 +67,7 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
6667

6768
FileSpan spanFrom(LineScannerState startState, [LineScannerState endState]) {
6869
var endPosition = endState == null ? position : endState.position;
69-
return _sourceFile.span(
70-
_startLocation.offset + startState.position,
70+
return _sourceFile.span(_startLocation.offset + startState.position,
7171
_startLocation.offset + endPosition);
7272
}
7373

@@ -77,8 +77,7 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
7777
return false;
7878
}
7979

80-
_lastSpan = _sourceFile.span(
81-
_startLocation.offset + position,
80+
_lastSpan = _sourceFile.span(_startLocation.offset + position,
8281
_startLocation.offset + lastMatch.end);
8382
return true;
8483
}
@@ -92,8 +91,7 @@ class RelativeSpanScanner extends StringScanner implements SpanScanner {
9291
}
9392
if (length == null) length = match == null ? 1 : match.end - match.start;
9493

95-
var span = _sourceFile.span(
96-
_startLocation.offset + position,
94+
var span = _sourceFile.span(_startLocation.offset + position,
9795
_startLocation.offset + position + length);
9896
throw new StringScannerException(message, span, string);
9997
}

lib/src/span_scanner.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ class SpanScanner extends StringScanner implements LineScanner {
4242
if (lastMatch == null) _lastSpan = null;
4343
return _lastSpan;
4444
}
45+
4546
FileSpan _lastSpan;
4647

4748
/// The current location of the scanner.

lib/src/string_scanner.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class StringScanner {
3434
_position = position;
3535
_lastMatch = null;
3636
}
37+
3738
int _position = 0;
3839

3940
/// The data about the previous match made by the scanner.
@@ -45,6 +46,7 @@ class StringScanner {
4546
if (_position != _lastMatchPosition) _lastMatch = null;
4647
return _lastMatch;
4748
}
49+
4850
Match _lastMatch;
4951
int _lastMatchPosition;
5052

test/span_scanner_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import 'package:test/test.dart';
99
import 'utils.dart';
1010

1111
void main() {
12-
testForImplementation("lazy", ([string]) {
12+
testForImplementation("lazy", ([String string]) {
1313
return new SpanScanner(string ?? 'foo\nbar\nbaz', sourceUrl: 'source');
1414
});
1515

16-
testForImplementation("eager", ([string]) {
16+
testForImplementation("eager", ([String string]) {
1717
return new SpanScanner.eager(string ?? 'foo\nbar\nbaz',
1818
sourceUrl: 'source');
1919
});
@@ -93,8 +93,8 @@ void main() {
9393

9494
test(".error() uses an absolute span", () {
9595
scanner.expect("foo");
96-
expect(() => scanner.error('oh no!'),
97-
throwsStringScannerException("foo"));
96+
expect(
97+
() => scanner.error('oh no!'), throwsStringScannerException("foo"));
9898
});
9999

100100
test(".isDone returns true at the end of the span", () {
@@ -104,7 +104,7 @@ void main() {
104104
});
105105
}
106106

107-
void testForImplementation(String name, SpanScanner create()) {
107+
void testForImplementation(String name, SpanScanner create([String string])) {
108108
group("for a $name scanner", () {
109109
var scanner;
110110
setUp(() => scanner = create());

test/string_scanner_test.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ void main() {
178178
expect(scanner.rest, equals(' bar'));
179179
});
180180

181-
test("a non-matching expect throws a FormatException and sets lastMatch to "
181+
test(
182+
"a non-matching expect throws a FormatException and sets lastMatch to "
182183
"null", () {
183184
expect(scanner.matches(new RegExp('f(..)')), isTrue);
184185
expect(scanner.lastMatch, isNotNull);

0 commit comments

Comments
 (0)