Files
sdk/tests/lib_2/mirrors/instance_members_test.dart
T
Ben Konyi 5b60e5841d Migrated test block 222 to Dart 2.0.
Minor changes to a few tests, no major refactors.

Bug:
Change-Id: I66c00b6465597a3534071f8d70c4718f209d5e6e
Reviewed-on: https://dart-review.googlesource.com/3787
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-09-13 02:05:02 +00:00

55 lines
1.6 KiB
Dart

// Copyright (c) 2013, 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.
library test.instance_members;
import 'dart:mirrors';
import 'package:expect/expect.dart';
import 'declarations_model.dart' as declarations_model;
selectKeys(map, predicate) {
return map.keys.where((key) => predicate(map[key]));
}
main() {
ClassMirror cm = reflectClass(declarations_model.Class);
Expect.setEquals([
#+,
#instanceVariable,
const Symbol('instanceVariable='),
#instanceGetter,
const Symbol('instanceSetter='),
#instanceMethod,
#-,
#inheritedInstanceVariable,
const Symbol('inheritedInstanceVariable='),
#inheritedInstanceGetter,
const Symbol('inheritedInstanceSetter='),
#inheritedInstanceMethod,
#*,
#mixinInstanceVariable,
const Symbol('mixinInstanceVariable='),
#mixinInstanceGetter,
const Symbol('mixinInstanceSetter='),
#mixinInstanceMethod,
#hashCode,
#runtimeType,
#==,
#noSuchMethod,
#toString
], selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate));
// Filter out private to avoid implementation-specific members of Object.
Expect.setEquals([
#instanceVariable,
const Symbol('instanceVariable='),
#inheritedInstanceVariable,
const Symbol('inheritedInstanceVariable='),
#mixinInstanceVariable,
const Symbol('mixinInstanceVariable=')
], selectKeys(cm.instanceMembers, (dm) => !dm.isPrivate && dm.isSynthetic));
}