aboutsummaryrefslogblamecommitdiff
path: root/js/commonjs/export_asserts.js
blob: 9b823d3c55db4685eb97e5c5cd14d6995fc763eb (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
   




                                                                  





                                       

                                                                          


















                                                               
/**
 * @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.
 */

goog.require('goog.testing.asserts');

var global = Function('return this')();

// All of the closure "assert" functions are exported at the global level.
//
// 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];
  }
}

exports.COMPILED = COMPILED