-
Notifications
You must be signed in to change notification settings - Fork 124
Fix line number cache #1939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix line number cache #1939
Conversation
test/line_number_cache_test.dart
Outdated
@@ -0,0 +1,65 @@ | |||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update to 2019?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import 'package:dartdoc/src/line_number_cache.dart'; | ||
import 'package:path/path.dart' as pathLib; | ||
import 'package:test/test.dart'; | ||
import 'package:dartdoc/src/tuple.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/line_number_cache_test.dart
Outdated
|
||
test('single line without newline', () { | ||
File singleLineWithoutNewline = | ||
File(pathLib.join(_tempDir.path, 'single_line')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It hardly matters but I'm a little surprised to see new
s elided here (and not elsewhere).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new
is now consistently absent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resynced with head, review comments addressed. PTAL.
test/line_number_cache_test.dart
Outdated
@@ -0,0 +1,65 @@ | |||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
import 'package:dartdoc/src/line_number_cache.dart'; | ||
import 'package:path/path.dart' as pathLib; | ||
import 'package:test/test.dart'; | ||
import 'package:dartdoc/src/tuple.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
test/line_number_cache_test.dart
Outdated
|
||
test('single line without newline', () { | ||
File singleLineWithoutNewline = | ||
File(pathLib.join(_tempDir.path, 'single_line')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
new
is now consistently absent.
This results in a display error as originally written for locations that can't be found.
|
Fixes #1938. The line number cache had some fencepost problems and this corrects them, adding tests. Also eliminates caching of file contents that won't be used more than once, anyway.
Note: dartfmt has some ideas about formatting that seem to have changed in the last version. See the first commit for real changes.