Skip to content

Commit 6d3e470

Browse files
committed
Add unit tests for compiler implementations
1 parent e74ab5c commit 6d3e470

File tree

19 files changed

+250
-1
lines changed

19 files changed

+250
-1
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ docs/_build/
1313
coverage/
1414
tests/static/
1515
tests/assets/js/dummy.js
16+
tests/node_modules/
1617
.tox/
1718
.DS_Store
1819
.idea
@@ -21,3 +22,6 @@ tests/assets/js/dummy.js
2122
.pydevproject
2223
.ropeproject
2324
__pycache__
25+
npm-debug.log
26+
tests/npm-cache
27+
django-pipeline-*/

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ recursive-include pipeline/jinja2 *.html *.jinja
33
include AUTHORS LICENSE README.rst HISTORY.rst
44
recursive-include tests *
55
recursive-exclude tests *.pyc *.pyo
6+
recursive-exclude tests/node_modules *
7+
recursive-exclude tests/npm-cache *
8+
recursive-exclude tests/npm *
69
include docs/Makefile docs/make.bat docs/conf.py
710
recursive-include docs *.rst
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(function() {
2+
var cube, square;
3+
4+
square = function(x) {
5+
return x * x;
6+
};
7+
8+
cube = function(x) {
9+
return square(x) * x;
10+
};
11+
12+
}).call(this);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
square = (x) -> x * x
2+
cube = (x) -> square(x) * x
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"use strict";
2+
3+
// Expression bodies
4+
var odds = evens.map(function (v) {
5+
return v + 1;
6+
});
7+
var nums = evens.map(function (v, i) {
8+
return v + i;
9+
});
10+
11+
// Statement bodies
12+
nums.forEach(function (v) {
13+
if (v % 5 === 0) fives.push(v);
14+
});
15+
16+
// Lexical this
17+
var bob = {
18+
_name: "Bob",
19+
_friends: [],
20+
printFriends: function printFriends() {
21+
var _this = this;
22+
23+
this._friends.forEach(function (f) {
24+
return console.log(_this._name + " knows " + f);
25+
});
26+
}
27+
};

tests/assets/compilers/es6/input.es6

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Expression bodies
2+
var odds = evens.map(v => v + 1);
3+
var nums = evens.map((v, i) => v + i);
4+
5+
// Statement bodies
6+
nums.forEach(v => {
7+
if (v % 5 === 0)
8+
fives.push(v);
9+
});
10+
11+
// Lexical this
12+
var bob = {
13+
_name: "Bob",
14+
_friends: [],
15+
printFriends() {
16+
this._friends.forEach(f =>
17+
console.log(this._name + " knows " + f));
18+
}
19+
};
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.a {
2+
width: 1px;
3+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@a: 1;
2+
3+
.a {
4+
width: (@a + 0px);
5+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
(function(){
2+
var times;
3+
times = function(x, y){
4+
return x * y;
5+
};
6+
}).call(this);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
times = (x, y) ->
2+
x * y

0 commit comments

Comments
 (0)