| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 <link rel="import" href="/tracing/base/utils.html"> | 7 <link rel="import" href="/tracing/base/utils.html"> |
| 8 | 8 |
| 9 <script> | 9 <script> |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 tr.b.unittest.testSuite(function() { | 12 tr.b.unittest.testSuite(function() { |
| 13 test('getUsingPath', function() { | 13 test('getUsingPath', function() { |
| 14 var z = tr.b.getUsingPath('x.y.z', {'x': {'y': {'z': 3}}}); | 14 var z = tr.b.getUsingPath('x.y.z', {'x': {'y': {'z': 3}}}); |
| 15 assert.equal(z, 3); | 15 assert.equal(z, 3); |
| 16 | 16 |
| 17 var w = tr.b.getUsingPath('x.w', {'x': {'y': {'z': 3}}}); | 17 var w = tr.b.getUsingPath('x.w', {'x': {'y': {'z': 3}}}); |
| 18 assert.isUndefined(w); | 18 assert.isUndefined(w); |
| 19 }); | 19 }); |
| 20 | 20 |
| 21 test('testExceptionNaming', function() { | 21 test('testExceptionNaming', function() { |
| 22 var err = new Error('asdf'); | 22 var err = new Error('asdf'); |
| 23 err.name = 'MyError'; | 23 err.name = 'MyError'; |
| 24 | 24 |
| 25 var ex = tr.b.normalizeException(err); | 25 var ex = tr.b.normalizeException(err); |
| 26 assert.equal(ex.typeName, 'MyError'); | 26 assert.equal(ex.typeName, 'MyError'); |
| 27 }); | 27 }); |
| 28 | 28 |
| 29 test('testFlattenArray', function() { |
| 30 var arr = [[1, 2, 100], [2, 3], [], [4, 5, 6]]; |
| 31 assert.deepEqual(tr.b.flattenArray(arr), |
| 32 [1, 2, 100, 2, 3, 4, 5, 6]); |
| 33 }); |
| 34 |
| 29 }); | 35 }); |
| 30 </script> | 36 </script> |
| OLD | NEW |