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

Side by Side Diff: pkg/analysis_server/test/services/index/indexable_file_test.dart

Issue 1801883002: Remove old index and search implementations. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
(Empty)
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
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.
4
5 library test.services.index.indexable_file;
6
7 import 'package:analysis_server/src/services/index/indexable_file.dart';
8 import 'package:analysis_server/src/services/index/store/codec.dart';
9 import 'package:test_reflective_loader/test_reflective_loader.dart';
10 import 'package:unittest/unittest.dart';
11
12 import '../../utils.dart';
13
14 main() {
15 initializeTestEnvironment();
16 defineReflectiveTests(IndexableFileKindTest);
17 defineReflectiveTests(IndexableFileTest);
18 }
19
20 @reflectiveTest
21 class IndexableFileKindTest {
22 void test_decode() {
23 IndexableFile object =
24 IndexableFileKind.INSTANCE.decode(null, '/a.dart', -1);
25 expect(object.path, '/a.dart');
26 }
27
28 void test_encodeHash() {
29 StringCodec stringCodec = new StringCodec();
30 String path = '/a/bb/ccc.dart';
31 int hash1 = IndexableFileKind.INSTANCE
32 .encodeHash(stringCodec.encode, new IndexableFile(path));
33 int hash2 = IndexableFileKind.INSTANCE
34 .encodeHash(stringCodec.encode, new IndexableFile(path));
35 expect(hash2, hash1);
36 }
37 }
38
39 @reflectiveTest
40 class IndexableFileTest {
41 void test_equals() {
42 IndexableFile a = new IndexableFile('/a.dart');
43 IndexableFile a2 = new IndexableFile('/a.dart');
44 IndexableFile b = new IndexableFile('/b.dart');
45 expect(a == a, isTrue);
46 expect(a == a2, isTrue);
47 expect(a == b, isFalse);
48 }
49
50 void test_getters() {
51 String path = '/a/bb/ccc.dart';
52 IndexableFile indexable = new IndexableFile(path);
53 expect(indexable.kind, IndexableFileKind.INSTANCE);
54 expect(indexable.filePath, path);
55 expect(indexable.offset, -1);
56 expect(indexable.toString(), path);
57 }
58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698