| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 deepEqual(base.filterDictionary(dictionary, function() { return true; }), { | 88 deepEqual(base.filterDictionary(dictionary, function() { return true; }), { |
| 89 "foo": 43, | 89 "foo": 43, |
| 90 "bar": 11 | 90 "bar": 11 |
| 91 }); | 91 }); |
| 92 deepEqual(base.filterDictionary(dictionary, function() { return false; }), {
}); | 92 deepEqual(base.filterDictionary(dictionary, function() { return false; }), {
}); |
| 93 deepEqual(base.filterDictionary(dictionary, function(key) { return key == 'f
oo'; }), { | 93 deepEqual(base.filterDictionary(dictionary, function(key) { return key == 'f
oo'; }), { |
| 94 "foo": 43 | 94 "foo": 43 |
| 95 }); | 95 }); |
| 96 }); | 96 }); |
| 97 | 97 |
| 98 test("mapDictionary", 3, function() { | |
| 99 deepEqual(base.mapDictionary({}, function(value) { return value - 10; }), {}
); | |
| 100 var dictionary = { | |
| 101 'foo': 43, | |
| 102 'bar': 11 | |
| 103 }; | |
| 104 deepEqual(base.mapDictionary(dictionary, function(value) { return value - 10
; }), { | |
| 105 "foo": 33, | |
| 106 "bar": 1 | |
| 107 }); | |
| 108 deepEqual(base.mapDictionary(dictionary, function(value) { | |
| 109 if (value > 20) | |
| 110 return value - 20; | |
| 111 }), { | |
| 112 "foo": 23, | |
| 113 }); | |
| 114 }); | |
| 115 | |
| 116 test("filterTree", 2, function() { | 98 test("filterTree", 2, function() { |
| 117 var tree = { | 99 var tree = { |
| 118 'path': { | 100 'path': { |
| 119 'to': { | 101 'to': { |
| 120 'test.html': { | 102 'test.html': { |
| 121 'actual': 'PASS', | 103 'actual': 'PASS', |
| 122 'expected': 'FAIL' | 104 'expected': 'FAIL' |
| 123 } | 105 } |
| 124 }, | 106 }, |
| 125 'another.html': { | 107 'another.html': { |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 test("parseJSONP", 6, function() { | 303 test("parseJSONP", 6, function() { |
| 322 deepEqual(base.parseJSONP(""), {}); | 304 deepEqual(base.parseJSONP(""), {}); |
| 323 deepEqual(base.parseJSONP('p({"key": "value"})'), {"key": "value"}); | 305 deepEqual(base.parseJSONP('p({"key": "value"})'), {"key": "value"}); |
| 324 deepEqual(base.parseJSONP('ADD_RESULTS({"dummy":"data"});'), {"dummy":"data"
}); | 306 deepEqual(base.parseJSONP('ADD_RESULTS({"dummy":"data"});'), {"dummy":"data"
}); |
| 325 deepEqual(base.parseJSONP('{"dummy":"data"}'), {"dummy":"data"}); | 307 deepEqual(base.parseJSONP('{"dummy":"data"}'), {"dummy":"data"}); |
| 326 deepEqual(base.parseJSONP('ADD_RESULTS({"builder(1)":"data"});'), {"builder(
1)":"data"}); | 308 deepEqual(base.parseJSONP('ADD_RESULTS({"builder(1)":"data"});'), {"builder(
1)":"data"}); |
| 327 deepEqual(base.parseJSONP('{"builder(1)":"data"}'), {"builder(1)":"data"}); | 309 deepEqual(base.parseJSONP('{"builder(1)":"data"}'), {"builder(1)":"data"}); |
| 328 }); | 310 }); |
| 329 | 311 |
| 330 })(); | 312 })(); |
| OLD | NEW |