Skip to content
Browse files

passing set test hooray

  • Loading branch information...
1 parent 45240c1 commit f4db834e8c364a034b907b42e8bc4b7c07e9440a @substack committed Jul 20, 2011
Showing with 27 additions and 12 deletions.
  1. +0 −11 ex.js
  2. +26 −0 test/stub.js
  3. +1 −1 { → test}/stub.json
View
11 ex.js
@@ -1,11 +0,0 @@
-var fs = require('fs');
-var jsup = require('./');
-var parse = require('uglify-js').parser.parse;
-
-var src = fs.readFileSync(__dirname + '/stub.json', 'utf8');
-var s = jsup(src)
- .set([ 'a', 2 ], 3)
- .set([ 'c' ], 'lul')
- .stringify()
-;
-console.log(s);
View
26 test/stub.js
@@ -0,0 +1,26 @@
+var assert = require('assert');
+var fs = require('fs');
+var jsup = require('../');
+
+var src = fs.readFileSync(__dirname + '/stub.json', 'utf8');
+
+exports.stub = function () {
+ assert.equal(jsup(src).stringify(), src);
+
+ assert.equal(
+ jsup(src)
+ .set([ 'a', 2 ], 3)
+ .stringify()
+ ,
+ src.replace('333333', '3')
+ );
+
+ assert.equal(
+ jsup(src)
+ .set([ 'a', 2 ], 3)
+ .set([ 'c' ], 'lul')
+ .stringify()
+ ,
+ src.replace('333333', '3').replace('444444', '"lul"')
+ );
+};
View
2 stub.json → test/stub.json
@@ -1,5 +1,5 @@
{
- "a" : [ 1, 2, 0 ] ,
+ "a" : [ 1, 2, 333333 ] ,
"b" : [ 3, 4, { "c" : [ 5, 6 ] } ],
"c" : 444444,
"d" : null

0 comments on commit f4db834

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