OLD | NEW |
(Empty) | |
| 1 /** |
| 2 * @fileoverview Exports symbols needed only by tests. |
| 3 * |
| 4 * This file exports several Closure Library symbols that are only |
| 5 * used by tests. It is used to generate a file |
| 6 * closure_asserts_commonjs.js that is only used at testing time. |
| 7 */ |
| 8 |
| 9 goog.require('goog.testing.asserts'); |
| 10 |
| 11 var global = Function('return this')(); |
| 12 |
| 13 // All of the closure "assert" functions are exported at the global level. |
| 14 // |
| 15 // The Google Closure assert functions start with assert, eg. |
| 16 // assertThrows |
| 17 // assertNotThrows |
| 18 // assertTrue |
| 19 // ... |
| 20 // |
| 21 // The one exception is the "fail" function. |
| 22 function shouldExport(str) { |
| 23 return str.lastIndexOf('assert') === 0 || str == 'fail'; |
| 24 } |
| 25 |
| 26 for (var key in global) { |
| 27 if ((typeof key == "string") && global.hasOwnProperty(key) && |
| 28 shouldExport(key)) { |
| 29 exports[key] = global[key]; |
| 30 } |
| 31 } |
| 32 |
| 33 // The COMPILED variable is set by Closure compiler to "true" when it compiles |
| 34 // JavaScript, so in practice this is equivalent to "exports.COMPILED = true". |
| 35 // This will disable some debugging functionality in debug.js. We could |
| 36 // investigate whether this can/should be enabled in CommonJS builds. |
| 37 exports.COMPILED = COMPILED |
OLD | NEW |