Skip to content
Browse files

Merge pull request #172 from qubyte/feature/travis

Added Travis CI support.
  • Loading branch information...
2 parents d000a99 + 1c95d92 commit 75fb4cc78abfa522fe300ecd0615bf3d7613eea2 @ronkorving ronkorving committed Jan 16, 2013
Showing with 90 additions and 16 deletions.
  1. +17 −0 .travis.yml
  2. +2 −0 README.md
  3. +6 −2 package.json
  4. +65 −14 test/test.exports.js
View
17 .travis.yml
@@ -0,0 +1,17 @@
+env:
+ - ZMQ="git://github.com/zeromq/zeromq2-x.git"
+ - ZMQ="git://github.com/zeromq/zeromq3-x.git"
+before_install:
+ - sudo apt-get install uuid-dev
+ - git clone --depth 1 $ZMQ zmqlib
+ - cd zmqlib
+ - ./autogen.sh
+ - ./configure
+ - make
+ - sudo make install
+ - sudo /sbin/ldconfig
+ - cd ..
+language: node_js
+node_js:
+ - "0.8"
+ - "0.9"
View
2 README.md
@@ -1,3 +1,5 @@
+[![Build Satus](https://travis-ci.org/JustinTulloss/zeromq.node)]
+
# node-zeromq
[ØMQ](http://www.zeromq.org/) bindings for node.js.
View
8 package.json
@@ -11,11 +11,15 @@
"should": "*",
"batch": "*",
"jade": "*",
- "dox": "*"
+ "dox": "*",
+ "semver": "*"
},
"engines": {
"node": ">=0.7.9"
},
+ "scripts": {
+ "test": "make test"
+ },
"contributors": [
"Justin Tulloss <justin.tulloss@gmail.com> (http://justin.harmonize.fm)",
"Stéphan Kochen <stephan@kochen.nl> (http://stephan.kochen.nl/)",
@@ -27,4 +31,4 @@
"Micheil Smith <micheil@brandedcode.com> (http://brandedcode.com/)",
"TJ Holowaychuk <tj@vision-media.ca> (http://tjholowaychuk.com/)"
]
-}
+}
View
79 test/test.exports.js
@@ -1,26 +1,77 @@
var zmq = require('../')
- , should = require('should');
+ , should = require('should')
+ , semver = require('semver');
// version
-zmq.version.should.match(/^\d+\.\d+\.\d+$/);
+semver.valid(zmq.version).should.be.ok;
-// socket types
+// socket types and socket opts
-['PUB', 'SUB', 'REQ', 'XREQ', 'XREP',
- 'DEALER', 'ROUTER', 'PUSH', 'PULL', 'PAIR'].forEach(function(type){
- zmq['ZMQ_' + type].should.be.a('number');
-});
+// All versions.
+var constants = [
+ 'PUB',
+ 'SUB',
+ 'REQ',
+ 'XREQ',
+ 'REP',
+ 'XREP',
+ 'DEALER',
+ 'ROUTER',
+ 'PUSH',
+ 'PULL',
+ 'PAIR',
+ 'AFFINITY',
+ 'IDENTITY',
+ 'SUBSCRIBE',
+ 'UNSUBSCRIBE',
+ 'RATE',
+ 'RECOVERY_IVL',
+ 'SNDBUF',
+ 'RCVBUF',
+ 'RCVMORE',
+ 'FD',
+ 'EVENTS',
+ 'TYPE',
+ 'LINGER',
+ 'RECONNECT_IVL',
+ 'BACKLOG',
+ 'POLLIN',
+ 'POLLOUT',
+ 'POLLERR',
+ 'SNDMORE'
+];
+
+// 2.x only.
+if (semver.satisfies(zmq.version, '2.x')) {
+ constants.concat([
+ 'HWM',
+ 'SWAP',
+ 'MCAST_LOOP',
+ 'NOBLOCK'
+ ]);
+}
+
+// 3.x only.
+if (semver.satisfies(zmq.version, '3.x')) {
+ constants.concat([
+ 'XPUB',
+ 'XSUB',
+ 'SNDHWM',
+ 'RCVHWM'
+ ]);
+}
-// socket opts
+// 3.2 and above.
+if (semver.gte('3.2')) {
+ constants.concat([
+ 'LAST_ENDPOINT'
+ ]);
+}
-['HWM', 'SWAP', 'AFFINITY', 'IDENTITY',
- 'SUBSCRIBE', 'UNSUBSCRIBE', 'RATE',
- 'RECOVERY_IVL', 'RECOVERY_IVL', 'MCAST_LOOP',
- 'SNDBUF', 'RCVBUF', 'RCVMORE', 'SNDMORE', 'FD', 'EVENTS',
- 'TYPE', 'LINGER', 'RECONNECT_IVL', 'BACKLOG'].forEach(function(prop){
- zmq['ZMQ_' + prop].should.be.a('number');
+constants.forEach(function(typeOrProp){
+ zmq['ZMQ_' + typeOrProp].should.be.a('number');
});
// states

0 comments on commit 75fb4cc

Please sign in to comment.
Something went wrong with that request. Please try again.