forked from protocolbuffers/protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
152 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,9 @@ | ||
{ | ||
"spec_dir": "", | ||
"spec_files": [ | ||
"*_test.js" | ||
"*_test.js", | ||
"binary/proto_test.js" | ||
], | ||
"helpers": [ | ||
"node_modules/google-closure-library/closure/goog/bootstrap/nodejs.js", | ||
"node_loader.js", | ||
"deps.js" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** | ||
* @fileoverview Description of this file. | ||
*/ | ||
|
||
var lineReader = require('readline').createInterface({ | ||
input: process.stdin, | ||
output: process.stdout | ||
}); | ||
|
||
var module = null; | ||
lineReader.on('line', function(line) { | ||
var is_require = line.match(/goog\.require\('([^']*\.)([^'.]+)'\)/); | ||
var is_loadfromfile = line.match(/CommonJS-LoadFromFile: (.*)/); | ||
var is_settestonly = line.match(/goog.setTestOnly()/); | ||
if (is_settestonly) { | ||
// Remove this line. | ||
} else if (is_require) { | ||
if (module) { // Skip goog.require() lines before the first directive. | ||
var pkg = is_require[1]; | ||
var sym = is_require[2]; | ||
console.log("google_protobuf.exportSymbol('" + pkg + sym + "', " + module + "." + sym + ', global);'); | ||
} | ||
} else if (is_loadfromfile) { | ||
if (!module) { | ||
console.log("var asserts = require('closure_asserts_commonjs');"); | ||
console.log("var global = Function('return this')();"); | ||
console.log(""); | ||
console.log("// Bring asserts into the global namespace."); | ||
console.log("for (var key in asserts) {"); | ||
console.log(" if (asserts.hasOwnProperty(key)) {"); | ||
console.log(" global[key] = asserts[key];"); | ||
console.log(" }"); | ||
console.log("}"); | ||
console.log(""); | ||
console.log("var google_protobuf = require('google-protobuf');"); | ||
} | ||
module = is_loadfromfile[1].replace("-", "_"); | ||
|
||
if (module != "google_protobuf") { // We unconditionally require this in the header. | ||
console.log("var " + module + " = require('" + is_loadfromfile[1] + "');"); | ||
} | ||
} else { | ||
console.log(line); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters