Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

moving around specs

  • Loading branch information...
commit 006230bf1b94eb7c2a7a73d868839704b52f5453 1 parent 58904b3
Scott Taylor authored
63 spec/compile-integration-spec.js → spec/integration/general-spec.js
View
@@ -1,6 +1,6 @@
var vows = require("vows");
var assert = require("assert");
-var loop = require(__dirname + "/../lib/loop");
+var loop = require(__dirname + "/../../lib/loop");
vows.describe("integration spec").addBatch({
'it should be able to compile a function call': function() {
@@ -82,40 +82,6 @@ vows.describe("integration spec").addBatch({
assert.equal(loop.compile(code), '(function(x,y){console.log(x+y)})(10,20)');
},
- 'it should be able to handle an if statement': function() {
- var code = "(if x (y))";
- assert.equal(loop.compile(code), 'if(x){y()}');
- },
-
- 'it should be able to handle an if statement with no block conditions': function() {
- var code = "(if x)";
-
- assert.equal(loop.compile(code), 'if(x){}');
- },
-
- 'it should be able to handle an if statement with multiple block conditions': function() {
- var code = "(if x (y) (+ 10 20))";
-
- assert.equal(loop.compile(code), 'if(x){y();10+20}');
- },
-
- 'it should allow non list types in the conditions': function() {
- var code = "(if true (y))";
-
- assert.equal(loop.compile(code), 'if(true){y()}');
- },
-
- 'it should allow a ! in the conditions': function() {
- var code = "(if (! foo) (y))";
-
- assert.equal(loop.compile(code), 'if(!foo){y()}');
- },
-
- 'it should allow === as a comparison operator': function() {
- var code = "(if (=== x 10) (console.log \"foo\"))";
- assert.equal(loop.compile(code), 'if(x===10){console.log("foo")}');
- },
-
'it should be able to create an object from the {} function': function() {
var code = "(var (x ({})))";
assert.equal(loop.compile(code), 'var x={}');
@@ -200,33 +166,6 @@ vows.describe("integration spec").addBatch({
assert.equal(loop.compile(code), "var foo");
},
- 'it should not insert semicolons into an if': function() {
- var defaultOptions = {
- indent_start : 0,
- indent_level : 2,
- quote_keys : false,
- space_colon : true,
- beautify : true,
- ascii_only : false,
- inline_script: false
- };
-
- var code = "";
- code += "(function (str options)";
- code += " (if (=== (typeof options) 'undefined')";
- code += " (= options {})))";
-
- var expected = "";
- expected += "(function(str, options) {\n";
- expected += " if (typeof options === \"undefined\") {\n";
- expected += " options = {};\n";
- expected += " }\n";
- expected += "});";
-
- assert.equal(loop.compile(code, defaultOptions),
- expected);
- },
-
'it should use || as OR': function() {
assert.equal(loop.compile("(|| a b)"),
"a||b");
66 spec/integration/if-cond-spec.js
View
@@ -0,0 +1,66 @@
+var vows = require("vows");
+var assert = require("assert");
+var loop = require(__dirname + "/../../lib/loop");
+
+vows.describe("if + cond").addBatch({
+ 'it should be able to handle an if statement': function() {
+ var code = "(if x (y))";
+ assert.equal(loop.compile(code), 'if(x){y()}');
+ },
+
+ 'it should be able to handle an if statement with no block conditions': function() {
+ var code = "(if x)";
+
+ assert.equal(loop.compile(code), 'if(x){}');
+ },
+
+ 'it should be able to handle an if statement with multiple block conditions': function() {
+ var code = "(if x (y) (+ 10 20))";
+
+ assert.equal(loop.compile(code), 'if(x){y();10+20}');
+ },
+
+ 'it should allow non list types in the conditions': function() {
+ var code = "(if true (y))";
+
+ assert.equal(loop.compile(code), 'if(true){y()}');
+ },
+
+ 'it should allow a ! in the conditions': function() {
+ var code = "(if (! foo) (y))";
+
+ assert.equal(loop.compile(code), 'if(!foo){y()}');
+ },
+
+ 'it should allow === as a comparison operator': function() {
+ var code = "(if (=== x 10) (console.log \"foo\"))";
+ assert.equal(loop.compile(code), 'if(x===10){console.log("foo")}');
+ },
+
+ 'it should not insert semicolons into an if': function() {
+ var defaultOptions = {
+ indent_start : 0,
+ indent_level : 2,
+ quote_keys : false,
+ space_colon : true,
+ beautify : true,
+ ascii_only : false,
+ inline_script: false
+ };
+
+ var code = "";
+ code += "(function (str options)";
+ code += " (if (=== (typeof options) 'undefined')";
+ code += " (= options {})))";
+
+ var expected = "";
+ expected += "(function(str, options) {\n";
+ expected += " if (typeof options === \"undefined\") {\n";
+ expected += " options = {};\n";
+ expected += " }\n";
+ expected += "});";
+
+ assert.equal(loop.compile(code, defaultOptions),
+ expected);
+ }
+}).export(module);
4 spec/macro-matching-spec.js → spec/macros/macro-matching-spec.js
View
@@ -1,7 +1,7 @@
var vows = require("vows");
var assert = require("assert");
-var loop = require(__dirname + "/../lib/loop");
-var macroCompiler = require(__dirname + "/../lib/loop/macro-compiler");
+var loop = require(__dirname + "/../../lib/loop");
+var macroCompiler = require(__dirname + "/../../lib/loop/macro-compiler");
var parseCode = function(code) {
return loop.parse(code)[0];
0  spec/integration/binary-spec.js → spec/uglify-compiling/binary-spec.js
View
File renamed without changes
0  spec/integration/booleans-spec.js → spec/uglify-compiling/booleans-spec.js
View
File renamed without changes
0  spec/integration/keywords-spec.js → spec/uglify-compiling/keywords-spec.js
View
File renamed without changes
0  spec/integration/number-spec.js → spec/uglify-compiling/number-spec.js
View
File renamed without changes
2  spec/tree-to-uglify-tree-spec.js → spec/uglify-compiling/tree-to-uglify-tree-spec.js
View
@@ -1,6 +1,6 @@
var vows = require("vows");
var assert = require("assert");
-var loop = require(__dirname + "/../lib/loop");
+var loop = require(__dirname + "/../../lib/loop");
vows.describe("phase 3: transform from eval'ed syntax into uglifyjs parse tree").addBatch({
'it should eval a function call': function() {
0  spec/integration/unary-spec.js → spec/uglify-compiling/unary-spec.js
View
File renamed without changes
Please sign in to comment.
Something went wrong with that request. Please try again.