mirror of
https://github.com/Oreolek/gamebookformat.git
synced 2024-06-28 20:55:13 +03:00
Stubs for testing html template javascript using node.js.
This commit is contained in:
parent
d431d1f47e
commit
0bad58abe3
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -15,3 +15,4 @@ target
|
||||||
*.map
|
*.map
|
||||||
.uploadto
|
.uploadto
|
||||||
readme.html
|
readme.html
|
||||||
|
node_modules
|
12
Makefile
12
Makefile
|
@ -38,7 +38,7 @@ readme.html: readme.org
|
||||||
%.png: %.dot
|
%.png: %.dot
|
||||||
dot -Tpng $< > $@
|
dot -Tpng $< > $@
|
||||||
|
|
||||||
test: unittest checkexpected
|
test: unittest checkexpected templatejstest
|
||||||
|
|
||||||
expected: all
|
expected: all
|
||||||
$(RM) expected/* && cp examples/*.{rtf,tex,html,debug,txt,dot,map} \
|
$(RM) expected/* && cp examples/*.{rtf,tex,html,debug,txt,dot,map} \
|
||||||
|
@ -55,9 +55,17 @@ unittest: *.py
|
||||||
|
|
||||||
upload: html png pdf rtf
|
upload: html png pdf rtf
|
||||||
if [ -n "$(uploadto)" ]; then \
|
if [ -n "$(uploadto)" ]; then \
|
||||||
scp examples/*.html examples/*.png examples/*.pdf examples/*.rtf $(uploadto);\
|
scp examples/*.html examples/*.png examples/*.pdf examples/*.rtf \
|
||||||
|
$(uploadto);\
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test/templatejs/htmlscripts.js: $(wildcard templates/html/*script.html)
|
||||||
|
./templates.py html script > $@
|
||||||
|
|
||||||
|
templatejstest: test/templatejs/htmlscripts.js \
|
||||||
|
test/templatejs/testhtmlscripts.js
|
||||||
|
node test/templatejs/testhtmlscripts.js
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) examples/*rtf examples/*.html examples/*.tex \
|
$(RM) examples/*rtf examples/*.html examples/*.tex \
|
||||||
examples/*.txt examples/*.debug examples/*.log \
|
examples/*.txt examples/*.debug examples/*.log \
|
||||||
|
|
19
readme.org
19
readme.org
|
@ -43,6 +43,25 @@ configuration (eg /C-c C-q/ to edit section tags).
|
||||||
References to sections can be followed using
|
References to sections can be followed using
|
||||||
/C-c C-o/ while editing the book in org-mode.
|
/C-c C-o/ while editing the book in org-mode.
|
||||||
|
|
||||||
|
** Dependencies
|
||||||
|
|
||||||
|
*** Required
|
||||||
|
- Python 2.7 :: To run formatgamebook.py.
|
||||||
|
|
||||||
|
*** Optional
|
||||||
|
To make something useful from some of the outputted files.
|
||||||
|
- pdflatex :: Make pdf from tex files.
|
||||||
|
- Graphviz :: Includes the dot command that can make images from dot files.
|
||||||
|
|
||||||
|
*** Development
|
||||||
|
The following are only needed for working on improving
|
||||||
|
the scripts (and even then you can proabbly do without all or most).
|
||||||
|
- GNU make :: Runs tests and various other useful development tasks.
|
||||||
|
(This in turn depends on some tools like diff, but if you
|
||||||
|
have make installed you probably have them as well.)
|
||||||
|
- node.js :: To run some tests of HTML (JavaScript) templates.
|
||||||
|
- nodeunit :: Unit test framework for node.js.
|
||||||
|
|
||||||
** License
|
** License
|
||||||
|
|
||||||
Copyright (c) 2013 Pelle Nilsson
|
Copyright (c) 2013 Pelle Nilsson
|
||||||
|
|
|
@ -3,3 +3,9 @@
|
||||||
#include "extra-gamebookscript"
|
#include "extra-gamebookscript"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// little hack to make easy to test from node.js
|
||||||
|
if (typeof exports !== 'undefined') {
|
||||||
|
exports.gamebook = gamebook;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
1
test/templatejs/.gitignore
vendored
Normal file
1
test/templatejs/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
htmlscripts.js
|
17
test/templatejs/testhtmlscripts.js
Executable file
17
test/templatejs/testhtmlscripts.js
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/usr/bin/env node
|
||||||
|
|
||||||
|
exports.setUp = function(cb) {
|
||||||
|
this.hs = hs = require('./htmlscripts.js');
|
||||||
|
cb();
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.test1 = function(test) {
|
||||||
|
test.deepEqual(this.hs.gamebook.player.collections, {});
|
||||||
|
test.done();
|
||||||
|
};
|
||||||
|
|
||||||
|
var reporter = require('nodeunit').reporters['default'];
|
||||||
|
|
||||||
|
process.chdir(__dirname);
|
||||||
|
reporter.run(['./testhtmlscripts.js']);
|
||||||
|
|
Loading…
Reference in a new issue