Skip to content

Commit

Permalink
fix #8
Browse files Browse the repository at this point in the history
  • Loading branch information
mohayonao committed Mar 22, 2014
1 parent 96391f2 commit eb6fe43
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
9 changes: 6 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,16 +340,19 @@ module.exports = function(grunt) {
}

function makeBrowserTest() {
var tests, tmpl;
var tmpl, tests, consts;

tmpl = grunt.file.read("assets/index.tmpl");

tests = grunt.file.expand("src/sc/**/*_test.js");
tests = tests.sort(testSorter).map(function(filepath) {
return " <script src=\"../../../" + filepath + "\"></script>";
});

tmpl = grunt.file.read("assets/index.tmpl");
tmpl = tmpl.replace("#{TESTS}", tests.join("\n"));

consts = grunt.file.read("src/const.js").trim();
tmpl = tmpl.replace("#{CONSTS}", consts);

grunt.file.write("docs/report/test/index.html", tmpl);
}

Expand Down
3 changes: 3 additions & 0 deletions assets/index.tmpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Online Test Suite - SCScript</title>
<link rel="stylesheet" href="../../../assets/mocha.css">
<script src="../../../assets/jquery.min.js"></script>
<script src="../../../assets/mocha.js"></script>
Expand All @@ -15,6 +17,7 @@
SCScript.install(function(sc) {
window.sc = sc;
});
#{CONSTS}
mocha.setup("bdd");
$(function() {
mocha.run();
Expand Down
40 changes: 26 additions & 14 deletions src/const.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
module.exports = {
TAG_NOT_INITIALIZED: 0x00,
TAG_OBJ: 0x01,
TAG_INT: 0x02,
TAG_SYM: 0x03,
TAG_CHAR: 0x04,
TAG_NIL: 0x05,
TAG_FALSE: 0x06,
TAG_TRUE: 0x07,
TAG_PTR: 0x08,
TAG_FLOAT: 0x09,
TAG_STR: 0x0a,
TAG_UNUSED: 0xff,
};
(function(global) {
"use strict";

var C = {
TAG_NOT_INITIALIZED: 0x00,
TAG_OBJ: 0x01,
TAG_INT: 0x02,
TAG_SYM: 0x03,
TAG_CHAR: 0x04,
TAG_NIL: 0x05,
TAG_FALSE: 0x06,
TAG_TRUE: 0x07,
TAG_PTR: 0x08,
TAG_FLOAT: 0x09,
TAG_STR: 0x0a,
TAG_UNUSED: 0xff,
};

if (typeof global.sc !== "undefined") {
global.sc.C = C;
}
if (typeof module !== "undefined") {
module.exports = C;
}

})(this.self||global);

0 comments on commit eb6fe43

Please sign in to comment.