-
-
Notifications
You must be signed in to change notification settings - Fork 372
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add unit tests for compiler implementations
- Loading branch information
Showing
19 changed files
with
250 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function() { | ||
var cube, square; | ||
|
||
square = function(x) { | ||
return x * x; | ||
}; | ||
|
||
cube = function(x) { | ||
return square(x) * x; | ||
}; | ||
|
||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
square = (x) -> x * x | ||
cube = (x) -> square(x) * x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"use strict"; | ||
|
||
// Expression bodies | ||
var odds = evens.map(function (v) { | ||
return v + 1; | ||
}); | ||
var nums = evens.map(function (v, i) { | ||
return v + i; | ||
}); | ||
|
||
// Statement bodies | ||
nums.forEach(function (v) { | ||
if (v % 5 === 0) fives.push(v); | ||
}); | ||
|
||
// Lexical this | ||
var bob = { | ||
_name: "Bob", | ||
_friends: [], | ||
printFriends: function printFriends() { | ||
var _this = this; | ||
|
||
this._friends.forEach(function (f) { | ||
return console.log(_this._name + " knows " + f); | ||
}); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Expression bodies | ||
var odds = evens.map(v => v + 1); | ||
var nums = evens.map((v, i) => v + i); | ||
|
||
// Statement bodies | ||
nums.forEach(v => { | ||
if (v % 5 === 0) | ||
fives.push(v); | ||
}); | ||
|
||
// Lexical this | ||
var bob = { | ||
_name: "Bob", | ||
_friends: [], | ||
printFriends() { | ||
this._friends.forEach(f => | ||
console.log(this._name + " knows " + f)); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.a { | ||
width: 1px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@a: 1; | ||
|
||
.a { | ||
width: (@a + 0px); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(function(){ | ||
var times; | ||
times = function(x, y){ | ||
return x * y; | ||
}; | ||
}).call(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
times = (x, y) -> | ||
x * y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.a .b { | ||
display: none; } | ||
|
||
.c .d { | ||
display: block; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
.a { | ||
.b { | ||
display: none; | ||
} | ||
} | ||
.c { | ||
.d { | ||
display: block; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.a { | ||
color: #000; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
.a | ||
color: black |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"name": "django-pipeline-tests", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "Pipeline is an asset packaging library for Django.", | ||
"author": "Timothée Peignier <timothee.peignier@tryphon.org>", | ||
"license": "MIT", | ||
"readmeFilename": "../README.rst", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/jazzband/django-pipeline.git" | ||
}, | ||
"dependencies": { | ||
"babel-cli": "^6.4.5", | ||
"babel-preset-es2015": "^6.3.13", | ||
"coffee-script": "^1.10.0", | ||
"less": "^2.5.3", | ||
"livescript": "^1.4.0", | ||
"node-sass": "^3.4.2", | ||
"stylus": "^0.53.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
""" | ||
A cross-platform compatible `npm install` call, checking whether npm is | ||
in fact installed on the system first (and on windows, checking that the | ||
npm version is at least 3.0 because of a bug in 2.x with MAX_PATH) | ||
""" | ||
import distutils.spawn | ||
import os | ||
from pkg_resources import parse_version | ||
import re | ||
import subprocess | ||
import sys | ||
|
||
|
||
def main(): | ||
tests_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) | ||
if os.name == 'nt': | ||
try: | ||
npm_paths = subprocess.check_output(['where', 'npm.cmd']) | ||
except subprocess.CalledProcessError: | ||
return | ||
else: | ||
npm_bin = re.split(r'\r?\n', npm_paths)[0] | ||
else: | ||
npm_bin = distutils.spawn.find_executable('npm') | ||
if not npm_bin: | ||
return | ||
if os.name == 'nt': | ||
os.environ.setdefault('APPDATA', '.') | ||
npm_version = subprocess.check_output([npm_bin, '--version']).strip() | ||
# Skip on windows if npm version is less than 3 because of | ||
# MAX_PATH issues in version 2 | ||
if parse_version(npm_version) < parse_version('3.0'): | ||
return | ||
pipe = subprocess.Popen([npm_bin, 'install'], | ||
cwd=tests_dir, stdout=sys.stdout, stderr=sys.stderr) | ||
pipe.communicate() | ||
sys.exit(pipe.returncode) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters