Revision 93dd7360
Added by koszko almost 2 years ago
compute_scripts.awk | ||
---|---|---|
105 | 105 |
} |
106 | 106 |
} |
107 | 107 |
|
108 |
function wrap_file(filename) { |
|
109 |
print "\"use strict\";\n\n({fun: (function() {\n" |
|
108 |
function partially_wrap_file(filename) { |
|
110 | 109 |
print_imports_code(filename) |
111 | 110 |
printf "\n\n" |
112 | 111 |
|
... | ... | |
114 | 113 |
|
115 | 114 |
printf "\n\n" |
116 | 115 |
print_exports_code(filename) |
116 |
} |
|
117 |
|
|
118 |
function wrap_file(filename) { |
|
119 |
print "\"use strict\";\n\n({fun: (function() {\n" |
|
120 |
|
|
121 |
partially_wrap_file(filename) |
|
122 |
|
|
117 | 123 |
print "\n})}).fun();" |
118 | 124 |
} |
119 | 125 |
|
... | ... | |
151 | 157 |
} |
152 | 158 |
|
153 | 159 |
function print_usage() { |
154 |
printf "usage: %2 compute_scripts.awk script_dependencies|wrapped_code FILENAME[...]\n", |
|
160 |
printf "usage: %2 compute_scripts.awk script_dependencies|wrapped_code|partially_wrapped_code FILENAME[...]\n",
|
|
155 | 161 |
ARGV[0] > "/dev/stderr" |
156 | 162 |
exit 1 |
157 | 163 |
} |
... | ... | |
189 | 195 |
print("exports_init.js") |
190 | 196 |
if (compute_dependencies(root_filename) > 0) |
191 | 197 |
exit 1 |
198 |
} else if (operation == "partially_wrapped_code") { |
|
199 |
partially_wrap_file(root_filename) |
|
192 | 200 |
} else if (operation == "wrapped_code") { |
193 | 201 |
wrap_file(root_filename) |
194 | 202 |
} else { |
Also available in: Unified diff
improve unit testing approach
Unit tests were moved to their own subdirectory.
Fixtures common to many unit tests were moved to test/unit/conftest.py.
A facility to execute scripts in page's global scope was added.
A workaround was employed to present information about errors in injected scripts.
Sample unit tests for regexes in common/patterns.js were added.