Skip to content
This repository has been archived by the owner on Feb 22, 2018. It is now read-only.

Commit

Permalink
chore(tests): Remove 'new Symbol' call to reduce dart2js memory usage
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer committed Apr 29, 2014
1 parent b45ef59 commit 39977b5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/formatter/filter_spec.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@ library filter_spec;

import '../_specs.dart';

// Const keys to keep the compiler fast
var _nameToSymbol = const {
'name': const Symbol('name'),
'current': const Symbol('current'),
'first': const Symbol('first'),
'last': const Symbol('last'),
'done': const Symbol('done'),
'key': const Symbol('key'),
'nonkey': const Symbol('nonkey')
};

// Helper to simulate some real objects. Purposefully doesn't implement Map.
class DynamicObject {
final Map<Symbol, dynamic> _map = {};
DynamicObject([Map init]) {
init.forEach((key, value) => _map[new Symbol(key)] = value);
init.forEach((key, value) {
var symbol = _nameToSymbol[key];
if (symbol == null) { throw "Missing nameToSymbol[$key]"; }
_map[symbol] = value;
});
}
toString() => "$_map";
operator ==(DynamicObject other) {
Expand All @@ -33,7 +48,7 @@ class DynamicObject {
main() {
D([Map init]) => new DynamicObject(init);

describe('filter formatter', () {
ddescribe('filter formatter', () {
var filter;

beforeEach((Injector injector, FormatterMap filterMap) {
Expand Down

0 comments on commit 39977b5

Please sign in to comment.