| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Library providing basic test framework functionality. | 6 * @fileoverview Library providing basic test framework functionality. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // See assert.js for where this is used. | 9 // See assert.js for where this is used. |
| 10 this.traceAssertionsForTesting = true; | 10 this.traceAssertionsForTesting = true; |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 884 * @param {*} expected The expected value. | 884 * @param {*} expected The expected value. |
| 885 * @param {*} actual The actual value. | 885 * @param {*} actual The actual value. |
| 886 * @param {string=} opt_message Additional error message. | 886 * @param {string=} opt_message Additional error message. |
| 887 * @throws {Error} | 887 * @throws {Error} |
| 888 */ | 888 */ |
| 889 function assertEquals(expected, actual, opt_message) { | 889 function assertEquals(expected, actual, opt_message) { |
| 890 chai.assert.strictEqual(actual, expected, opt_message); | 890 chai.assert.strictEqual(actual, expected, opt_message); |
| 891 } | 891 } |
| 892 | 892 |
| 893 /** | 893 /** |
| 894 * @param {*} expected |
| 895 * @param {*} actual |
| 896 * {string=} opt_message |
| 897 * @throws {Error} |
| 898 */ |
| 899 function assertDeepEquals(expected, actual, opt_message) { |
| 900 chai.assert.deepEqual(actual, expected, opt_message); |
| 901 } |
| 902 |
| 903 /** |
| 894 * @param {number} value1 The first operand. | 904 * @param {number} value1 The first operand. |
| 895 * @param {number} value2 The second operand. | 905 * @param {number} value2 The second operand. |
| 896 * @param {string=} opt_message Additional error message. | 906 * @param {string=} opt_message Additional error message. |
| 897 * @throws {Error} | 907 * @throws {Error} |
| 898 */ | 908 */ |
| 899 function assertLE(value1, value2, opt_message) { | 909 function assertLE(value1, value2, opt_message) { |
| 900 chai.expect(value1).to.be.at.most(value2, opt_message); | 910 chai.expect(value1).to.be.at.most(value2, opt_message); |
| 901 } | 911 } |
| 902 | 912 |
| 903 /** | 913 /** |
| (...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 /** | 1670 /** |
| 1661 * Exports assertion methods. All assertion methods delegate to the chai.js | 1671 * Exports assertion methods. All assertion methods delegate to the chai.js |
| 1662 * assertion library. | 1672 * assertion library. |
| 1663 */ | 1673 */ |
| 1664 function exportChaiAsserts() { | 1674 function exportChaiAsserts() { |
| 1665 exports.assertTrue = assertTrue; | 1675 exports.assertTrue = assertTrue; |
| 1666 exports.assertFalse = assertFalse; | 1676 exports.assertFalse = assertFalse; |
| 1667 exports.assertGE = assertGE; | 1677 exports.assertGE = assertGE; |
| 1668 exports.assertGT = assertGT; | 1678 exports.assertGT = assertGT; |
| 1669 exports.assertEquals = assertEquals; | 1679 exports.assertEquals = assertEquals; |
| 1680 exports.assertDeepEquals = assertDeepEquals; |
| 1670 exports.assertLE = assertLE; | 1681 exports.assertLE = assertLE; |
| 1671 exports.assertLT = assertLT; | 1682 exports.assertLT = assertLT; |
| 1672 exports.assertNotEquals = assertNotEquals; | 1683 exports.assertNotEquals = assertNotEquals; |
| 1673 exports.assertNotReached = assertNotReached; | 1684 exports.assertNotReached = assertNotReached; |
| 1674 } | 1685 } |
| 1675 | 1686 |
| 1676 /** | 1687 /** |
| 1677 * Exports expect methods. 'expect*' methods allow tests to run until the end | 1688 * Exports expect methods. 'expect*' methods allow tests to run until the end |
| 1678 * even in the presence of failures. | 1689 * even in the presence of failures. |
| 1679 */ | 1690 */ |
| 1680 function exportExpects() { | 1691 function exportExpects() { |
| 1681 exports.expectTrue = createExpect(assertTrue); | 1692 exports.expectTrue = createExpect(assertTrue); |
| 1682 exports.expectFalse = createExpect(assertFalse); | 1693 exports.expectFalse = createExpect(assertFalse); |
| 1683 exports.expectGE = createExpect(assertGE); | 1694 exports.expectGE = createExpect(assertGE); |
| 1684 exports.expectGT = createExpect(assertGT); | 1695 exports.expectGT = createExpect(assertGT); |
| 1685 exports.expectEquals = createExpect(assertEquals); | 1696 exports.expectEquals = createExpect(assertEquals); |
| 1697 exports.expectDeepEquals = createExpect(assertDeepEquals); |
| 1686 exports.expectLE = createExpect(assertLE); | 1698 exports.expectLE = createExpect(assertLE); |
| 1687 exports.expectLT = createExpect(assertLT); | 1699 exports.expectLT = createExpect(assertLT); |
| 1688 exports.expectNotEquals = createExpect(assertNotEquals); | 1700 exports.expectNotEquals = createExpect(assertNotEquals); |
| 1689 exports.expectNotReached = createExpect(assertNotReached); | 1701 exports.expectNotReached = createExpect(assertNotReached); |
| 1690 exports.expectAccessibilityOk = createExpect(assertAccessibilityOk); | 1702 exports.expectAccessibilityOk = createExpect(assertAccessibilityOk); |
| 1691 } | 1703 } |
| 1692 | 1704 |
| 1693 /** | 1705 /** |
| 1694 * Exports methods related to Mock4JS mocking. | 1706 * Exports methods related to Mock4JS mocking. |
| 1695 */ | 1707 */ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1724 exports.runTest = runTest; | 1736 exports.runTest = runTest; |
| 1725 exports.runTestFunction = runTestFunction; | 1737 exports.runTestFunction = runTestFunction; |
| 1726 exports.DUMMY_URL = DUMMY_URL; | 1738 exports.DUMMY_URL = DUMMY_URL; |
| 1727 exports.TEST = TEST; | 1739 exports.TEST = TEST; |
| 1728 exports.TEST_F = TEST_F; | 1740 exports.TEST_F = TEST_F; |
| 1729 exports.RUNTIME_TEST_F = TEST_F; | 1741 exports.RUNTIME_TEST_F = TEST_F; |
| 1730 exports.GEN = GEN; | 1742 exports.GEN = GEN; |
| 1731 exports.GEN_INCLUDE = GEN_INCLUDE; | 1743 exports.GEN_INCLUDE = GEN_INCLUDE; |
| 1732 exports.WhenTestDone = WhenTestDone; | 1744 exports.WhenTestDone = WhenTestDone; |
| 1733 })(this); | 1745 })(this); |
| OLD | NEW |