Files
sdk/pkg/vm_snapshot_analysis/test/name_test.dart
T
Vyacheslav Egorov 117df0e98b [vm/tools] Move snapshot analysis tool to its own package.
This code will be published on Pub so that Dev Tools can consume it.

Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-win-release-try,pkg-mac-release-try
Change-Id: Iddfbd3f0976af218d29ac20b452fbb139983a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152008
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2020-06-23 13:14:41 +00:00

32 lines
1.2 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/name.dart';
void main() async {
group('name', () {
test('scrubbing', () async {
expect(Name('[Optimized] [Stub] name').scrubbed, equals('name'),
reason: 'Prefixes are removed');
expect(
Name('name@1234.of@5678.method@9').scrubbed, equals('name.of.method'),
reason: 'Private keys are removed');
expect(Name('name@1234.<anonymous closure @1234>').scrubbed,
equals('name.<anonymous closure @1234>'),
reason: 'Closure token positions are preserved');
});
test('stub-name-parsing', () async {
expect(Name('[Stub] name').isStub, isTrue);
expect(Name('[Stub] name').isAllocationStub, isFalse);
expect(Name('[Stub] Allocate ').isStub, isTrue);
expect(Name('[Stub] Allocate ').isAllocationStub, isTrue);
expect(Name('[Optimized] name').isStub, isFalse);
expect(Name('[Optimized] name').isAllocationStub, isFalse);
});
});
}