[Pkg-mozext-commits] [adblock-plus] 16/464: Introducing the automated testing mechanism!
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:43:57 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 4797874d95eebe951ba90ebf774a99b53d050886
Author: Joshua Cranmer <Pidgeot18 at gmail.com>
Date: Thu Feb 19 21:01:18 2009 -0500
Introducing the automated testing mechanism!
---
Makefile | 16 ++++++++++++++++
autotest/test_globals.js | 24 ++++++++++++++++++++++++
autotest/test_globals.js.expected | 7 +++++++
jshydra.cpp | 1 +
4 files changed, 48 insertions(+)
diff --git a/Makefile b/Makefile
index 11ebdb0..1a68bf1 100644
--- a/Makefile
+++ b/Makefile
@@ -22,3 +22,19 @@ jshydra_funcs.o: jshydra_funcs.cpp
g++ -o jshydra_funcs.o -g $(INCLUDE) -c jshydra_funcs.cpp
jshydra_bridge.o: jshydra_bridge.cpp
g++ -o jshydra_bridge.o -g $(INCLUDE) -c jshydra_bridge.cpp -DDEBUG
+
+TESTS := $(notdir $(wildcard autotest/test_*.js))
+check: jshydra
+ @cd autotest && for f in $(TESTS); do \
+ eval $$(cat $$f | sed -e '/^\/\/ [A-Za-z]*:/!q' -e 's+^// \([A-Za-z]*\): \(.*\)$$+export \1="\2"+'); \
+ echo -n "$$Name... "; \
+ ../jshydra $$f $$Arguments &> .$$f.out; \
+ if diff -q ".$$f.out" "$$f.expected" &>/dev/null; then \
+ echo ' passed!'; \
+ else \
+ echo ' failed! Log:'; \
+ cat .$$f.out; \
+ fi \
+ done && rm .*.out
+
+.PHONY: check
diff --git a/autotest/test_globals.js b/autotest/test_globals.js
new file mode 100644
index 0000000..883b28b
--- /dev/null
+++ b/autotest/test_globals.js
@@ -0,0 +1,24 @@
+// Arguments: test_globals.js
+// Name: Global information test
+
+include("../scripts/cleanast.js");
+
+var glob = this;
+const LS = "foobar";
+
+function process_js(ast) {
+ let toplevel = clean_ast(ast);
+ _print("Global variables:");
+ for each (let v in toplevel.variables) {
+ _print("\t" + v.name + " at " + v.loc.line + ":" + v.loc.column);
+ }
+ _print("Global constants:");
+ for each (let v in toplevel.constants) {
+ _print("\t" + v.name + " at " + v.loc.line + ":" + v.loc.column);
+ }
+ _print("Global functions:");
+ for each (let v in toplevel.functions) {
+ _print("\t" + v.name + " at " + v.loc.line + ":" + v.loc.column);
+ _print(v.body.kids[0].column);
+ }
+}
diff --git a/autotest/test_globals.js.expected b/autotest/test_globals.js.expected
new file mode 100644
index 0000000..bf9d6ed
--- /dev/null
+++ b/autotest/test_globals.js.expected
@@ -0,0 +1,7 @@
+Global variables:
+ glob at 6:0
+Global constants:
+ LS at 7:0
+Global functions:
+ process_js at 9:25
+1
diff --git a/jshydra.cpp b/jshydra.cpp
index b888776..b242d92 100644
--- a/jshydra.cpp
+++ b/jshydra.cpp
@@ -228,4 +228,5 @@ int main(int argc, char **argv) {
parseFile(input, argv[0]);
} while (argc > 1);
+ return 0;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list