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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/file_state_test.dart

Issue 2987303002: Fix for truncated unlinked summaries in ByteStore. (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/file_state.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/file_system/memory_file_system.dart'; 10 import 'package:analyzer/file_system/memory_file_system.dart';
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
594 print(222); 594 print(222);
595 } 595 }
596 } 596 }
597 '''); 597 ''');
598 bool apiSignatureChanged = file.refresh(); 598 bool apiSignatureChanged = file.refresh();
599 expect(apiSignatureChanged, isFalse); 599 expect(apiSignatureChanged, isFalse);
600 600
601 expect(file.apiSignature, signature); 601 expect(file.apiSignature, signature);
602 } 602 }
603 603
604 test_store_zeroLengthUnlinked() {
605 String path = _p('/test.dart');
606 provider.newFile(path, 'class A {}');
607
608 // Get the file, prepare unlinked.
609 FileState file = fileSystemState.getFileForPath(path);
610 expect(file.unlinked, isNotNull);
611
612 // Make the unlinked unit in the byte store zero-length, damaged.
613 byteStore.put(file.test.unlinkedKey, <int>[]);
614
615 // Refresh should not fail, zero bytes in the store are ignored.
616 file.refresh();
617 expect(file.unlinked, isNotNull);
618 }
619
604 test_subtypedNames() { 620 test_subtypedNames() {
605 String path = _p('/test.dart'); 621 String path = _p('/test.dart');
606 provider.newFile(path, r''' 622 provider.newFile(path, r'''
607 class X extends A {} 623 class X extends A {}
608 class Y extends A with B {} 624 class Y extends A with B {}
609 class Z implements C, D {} 625 class Z implements C, D {}
610 '''); 626 ''');
611 FileState file = fileSystemState.getFileForPath(path); 627 FileState file = fileSystemState.getFileForPath(path);
612 expect(file.referencedNames, unorderedEquals(['A', 'B', 'C', 'D'])); 628 expect(file.referencedNames, unorderedEquals(['A', 'B', 'C', 'D']));
613 } 629 }
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 String _p(String path) => provider.convertPath(path); 826 String _p(String path) => provider.convertPath(path);
811 827
812 static String _md5(String content) { 828 static String _md5(String content) {
813 return hex.encode(md5.convert(UTF8.encode(content)).bytes); 829 return hex.encode(md5.convert(UTF8.encode(content)).bytes);
814 } 830 }
815 } 831 }
816 832
817 class _GeneratedUriResolverMock extends Mock implements UriResolver {} 833 class _GeneratedUriResolverMock extends Mock implements UriResolver {}
818 834
819 class _SourceMock extends Mock implements Source {} 835 class _SourceMock extends Mock implements Source {}
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/file_state.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698