From 9e60036c1b1db947d29cbaaa668aeae19e7d2068 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Thu, 4 Feb 2016 10:38:06 -0800 Subject: Moved CommonJS-specific files to commonjs/. --- js/commonjs/export_asserts.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/commonjs/export_asserts.js (limited to 'js/commonjs/export_asserts.js') diff --git a/js/commonjs/export_asserts.js b/js/commonjs/export_asserts.js new file mode 100644 index 00000000..16abdd7d --- /dev/null +++ b/js/commonjs/export_asserts.js @@ -0,0 +1,27 @@ +/** + * @fileoverview Description of this file. + */ + +goog.require('goog.testing.asserts'); + +var global = Function('return this')(); + +// 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 -- cgit v1.2.3