99a233505f
Support splitting paths that look like: `package:foo.bar.baz/src/foobar.dart` as well as "normal" paths (`package:foo/bar/baz/src/foobar.dart`). Change-Id: I7816b7d6fd34d786a735bf74e3ea2a2606c27af5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157023 Commit-Queue: Kenzie Schmoll <kenzieschmoll@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
74 lines
1.9 KiB
Dart
74 lines
1.9 KiB
Dart
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
import 'package:vm_snapshot_analysis/utils.dart';
|
|
|
|
void main() async {
|
|
group('utils', () {
|
|
test('partsForPath', () async {
|
|
expect(partsForPath('@shared'), equals(['@shared']));
|
|
expect(
|
|
partsForPath('dart:async/_Future'),
|
|
equals(['dart:async', '_Future']),
|
|
);
|
|
expect(
|
|
partsForPath('dart:typed_data/_Int32x4/&'),
|
|
equals(['dart:typed_data', '_Int32x4', '&']),
|
|
);
|
|
expect(
|
|
partsForPath('package:foo/bar/baz/bop.dart'),
|
|
equals(['package:foo', 'bar', 'baz', 'bop.dart']),
|
|
);
|
|
expect(
|
|
partsForPath('package:foo.bar.baz/src/foobar/foobaz'),
|
|
equals(['package:foo', 'bar', 'baz', 'src', 'foobar', 'foobaz']),
|
|
);
|
|
expect(
|
|
partsForPath('package:foo.bar.baz/src/foobar/foobaz.dart/::/_method'),
|
|
equals([
|
|
'package:foo',
|
|
'bar',
|
|
'baz',
|
|
'src',
|
|
'foobar',
|
|
'foobaz.dart',
|
|
'::',
|
|
'_method',
|
|
]),
|
|
);
|
|
|
|
expect(
|
|
partsForPath('package:foo.bar.baz.proto/model.pb.dart'),
|
|
equals([
|
|
'package:foo',
|
|
'bar',
|
|
'baz',
|
|
'proto',
|
|
'model.pb.dart',
|
|
]),
|
|
);
|
|
expect(
|
|
partsForPath(
|
|
'package:a.b.c.d.e.f/src/page/controller.dart/PageController/new PageController./<anonymous closure @2770>'),
|
|
equals([
|
|
'package:a',
|
|
'b',
|
|
'c',
|
|
'd',
|
|
'e',
|
|
'f',
|
|
'src',
|
|
'page',
|
|
'controller.dart',
|
|
'PageController',
|
|
'new PageController.',
|
|
'<anonymous closure @2770>',
|
|
]),
|
|
);
|
|
});
|
|
});
|
|
}
|