3 # Run this to automatically create a new auto_test. Example:
5 # ./auto_tests/misc/new_test.sh axis-labels
7 # This will produce a new file in auto_tests/tests/axis_labels.js including
9 # var AxisLabelsTestCase = TestCase("axis-labels");
12 # It will also add a reference to this file to auto_tests/misc/local.html.
16 echo Usage
: $0 test-case-name-with-dashes
21 underscore_name
=$
(echo $1 |
sed 's/-/_/g')
22 camelCaseName
=$
(echo $1 | perl
-pe
's/-([a-z])/uc $1/ge')
23 testCaseName
=${camelCaseName}TestCase
25 test_file
=auto_tests
/tests
/$underscore_name.js
27 if [ -f
$test_file ]; then
28 echo $test_file already exists
32 cat <<END > $test_file;
34 * @fileoverview FILL THIS IN
36 * @author $(git config --get user.email) ($(git config --get user.name))
38 var $testCaseName = TestCase("$dashed_name");
40 $testCaseName.prototype.setUp = function() {
41 document.body.innerHTML = "<div id='graph'></div>";
44 $testCaseName.prototype.tearDown = function() {
47 $testCaseName.prototype.testNameGoesHere = function() {
59 var graph = document.getElementById("graph");
60 var g = new Dygraph(graph, data, opts);
68 perl
-pi
-e
'next unless /update_options.js/; print " <script type=\"text/javascript\" src=\"../tests/'$underscore_name'.js\"></script>\n"' auto_tests
/misc
/local.html
70 echo Wrote
test to
$test_file