2016-02-04 18:29:27 +00:00
|
|
|
/**
|
2016-02-04 22:58:45 +00:00
|
|
|
* @fileoverview Exports symbols needed only by tests.
|
|
|
|
*
|
|
|
|
* This file exports several Closure Library symbols that are only
|
|
|
|
* used by tests. It is used to generate a file
|
|
|
|
* closure_asserts_commonjs.js that is only used at testing time.
|
2016-02-04 18:29:27 +00:00
|
|
|
*/
|
|
|
|
|
2017-02-23 19:32:16 +00:00
|
|
|
// Include a dummy provide statement so that closurebuilder.py does not skip over this
|
|
|
|
// file.
|
|
|
|
goog.provide('jspb.ExportAsserts');
|
|
|
|
|
2016-02-04 18:29:27 +00:00
|
|
|
goog.require('goog.testing.asserts');
|
|
|
|
|
|
|
|
var global = Function('return this')();
|
|
|
|
|
2016-02-04 22:58:45 +00:00
|
|
|
// All of the closure "assert" functions are exported at the global level.
|
|
|
|
//
|
2016-02-04 18:29:27 +00:00
|
|
|
// The Google Closure assert functions start with assert, eg.
|
|
|
|
// assertThrows
|
|
|
|
// assertNotThrows
|
|
|
|
// assertTrue
|
|
|
|
// ...
|
|
|
|
//
|
|
|
|
// The one exception is the "fail" function.
|
|
|
|
function shouldExport(str) {
|
|
|
|
return str.lastIndexOf('assert') === 0 || str == 'fail';
|
|
|
|
}
|
|
|
|
|
|
|
|
for (var key in global) {
|
|
|
|
if ((typeof key == "string") && global.hasOwnProperty(key) &&
|
|
|
|
shouldExport(key)) {
|
|
|
|
exports[key] = global[key];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-16 23:29:49 +00:00
|
|
|
// The COMPILED variable is set by Closure compiler to "true" when it compiles
|
|
|
|
// JavaScript, so in practice this is equivalent to "exports.COMPILED = true".
|
|
|
|
// This will disable some debugging functionality in debug.js. We could
|
|
|
|
// investigate whether this can/should be enabled in CommonJS builds.
|
2016-02-04 18:29:27 +00:00
|
|
|
exports.COMPILED = COMPILED
|