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// Include a dummy provide statement so that closurebuilder.py does not skip over this 10// file. 11goog.provide('jspb.ExportAsserts'); 12 13goog.require('goog.testing.asserts'); 14 15var global = Function('return this')(); 16 17// All of the closure "assert" functions are exported at the global level. 18// 19// The Google Closure assert functions start with assert, eg. 20// assertThrows 21// assertNotThrows 22// assertTrue 23// ... 24// 25// The one exception is the "fail" function. 26function shouldExport(str) { 27 return str.lastIndexOf('assert') === 0 || str == 'fail'; 28} 29 30for (var key in global) { 31 if ((typeof key == "string") && global.hasOwnProperty(key) && 32 shouldExport(key)) { 33 exports[key] = global[key]; 34 } 35} 36 37// The COMPILED variable is set by Closure compiler to "true" when it compiles 38// JavaScript, so in practice this is equivalent to "exports.COMPILED = true". 39// This will disable some debugging functionality in debug.js. We could 40// investigate whether this can/should be enabled in CommonJS builds. 41exports.COMPILED = COMPILED 42