Permalink
Browse files

reworking tests for nodeunit execution

  • Loading branch information...
christkv committed Mar 8, 2012
1 parent 237eab3 commit d2914e8feaa1611095b8392c5a3b3b8856e49d66
View
@@ -5,6 +5,10 @@ name = all
total: build_native
+test: build_native
+ $(NODEUNIT) ./test/node
+ TEST_NATIVE=TRUE $(NODEUNIT) ./test/node
+
build_native:
$(MAKE) -C ./ext all
View
@@ -1,15 +1,15 @@
var bson = require('./bson');
exports.BSON = bson.BSON;
-exports.Long = require('../../lib/mongodb/bson/long').Long;
-exports.ObjectID = require('../../lib/mongodb/bson/objectid').ObjectID;
-exports.DBRef = require('../../lib/mongodb/bson/db_ref').DBRef;
-exports.Code = require('../../lib/mongodb/bson/code').Code;
-exports.Timestamp = require('../../lib/mongodb/bson/timestamp').Timestamp;
-exports.Binary = require('../../lib/mongodb/bson/binary').Binary;
-exports.Double = require('../../lib/mongodb/bson/double').Double;
-exports.MaxKey = require('../../lib/mongodb/bson/max_key').MaxKey;
-exports.MinKey = require('../../lib/mongodb/bson/min_key').MinKey;
-exports.Symbol = require('../../lib/mongodb/bson/symbol').Symbol;
+exports.Long = require('../lib/bson/long').Long;
+exports.ObjectID = require('../lib/bson/objectid').ObjectID;
+exports.DBRef = require('../lib/bson/db_ref').DBRef;
+exports.Code = require('../lib/bson/code').Code;
+exports.Timestamp = require('../lib/bson/timestamp').Timestamp;
+exports.Binary = require('../lib/bson/binary').Binary;
+exports.Double = require('../lib/bson/double').Double;
+exports.MaxKey = require('../lib/bson/max_key').MaxKey;
+exports.MinKey = require('../lib/bson/min_key').MinKey;
+exports.Symbol = require('../lib/bson/symbol').Symbol;
// Just add constants tot he Native BSON parser
exports.BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0;
View
@@ -0,0 +1,75 @@
+
+try {
+ exports.BSONPure = require('./bson');
+ exports.BSONNative = require('./ext');
+} catch(err) {
+ // do nothing
+}
+
+[ './binary_parser'
+ , './binary'
+ , './code'
+ , './db_ref'
+ , './double'
+ , './max_key'
+ , './min_key'
+ , './objectid'
+ , './symbol'
+ , './timestamp'
+ , './long'].forEach(function (path) {
+ var module = require('./' + path);
+ for (var i in module) {
+ exports[i] = module[i];
+ }
+});
+
+// Exports all the classes for the NATIVE JS BSON Parser
+exports.native = function() {
+ var classes = {};
+ // Map all the classes
+ [ './binary_parser'
+ , './binary'
+ , './code'
+ , './db_ref'
+ , './double'
+ , './max_key'
+ , './min_key'
+ , './objectid'
+ , './symbol'
+ , './timestamp'
+ , './long'
+ , '../../ext'
+].forEach(function (path) {
+ var module = require('./' + path);
+ for (var i in module) {
+ classes[i] = module[i];
+ }
+ });
+ // Return classes list
+ return classes;
+}
+
+// Exports all the classes for the PURE JS BSON Parser
+exports.pure = function() {
+ var classes = {};
+ // Map all the classes
+ [ './binary_parser'
+ , './binary'
+ , './code'
+ , './db_ref'
+ , './double'
+ , './max_key'
+ , './min_key'
+ , './objectid'
+ , './symbol'
+ , './timestamp'
+ , './long'
+ , '././bson'].forEach(function (path) {
+ var module = require('./' + path);
+ for (var i in module) {
+ classes[i] = module[i];
+ }
+ });
+ // Return classes list
+ return classes;
+}
View
@@ -13,7 +13,7 @@
, "darwin"
, "freebsd" ]
, "devDependencies": {
- , "nodeunit": "0.7.3"
+ "nodeunit": "0.7.3"
, "gleak": "0.2.3"
}
, "config": { "native" : false }
Oops, something went wrong.

0 comments on commit d2914e8

Please sign in to comment.