Skip to content

Instantly share code, notes, and snippets.

@erikeldridge
Created December 13, 2010 06:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erikeldridge/738737 to your computer and use it in GitHub Desktop.
Save erikeldridge/738737 to your computer and use it in GitHub Desktop.
files for auto-running yet tests
# Watchr script used in http://erikeldridge.wordpress.com/2010/12/13/running-yeti-tests-automatically-with-watchr/
# watch for changes in test files
watch( 'test/test_.*\.html' ) { |md|
system('clear');
system("yeti #{md[0]}")
}
# watch for changes in lib files
watch( 'lib/(.*)\.js' ) { |md|
system('clear');
system("yeti test/test_#{md[1]}.html")
}
# --------------------------------------------------
# Signal Handling
# --------------------------------------------------
# Ctrl-C
Signal.trap('INT') {
abort("\n")
}
// YUI 3 module used in http://erikeldridge.wordpress.com/2010/12/13/running-yeti-tests-automatically-with-watchr/
YUI.add('example', function(Y) {
Y.example = 'foo';
}, '1' ,{requires:[]});
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<!-- YUI 3 test runner used in http://erikeldridge.wordpress.com/2010/12/13/running-yeti-tests-automatically-with-watchr/ -->
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://yui.yahooapis.com/3.2.0/build/yui/yui-min.js"></script>
<script type="text/javascript" src="../lib/example.js"></script>
</head>
<body class="yui3-skin-sam yui-skin-sam">
<div id="console"></div>
<script type="text/javascript">
YUI().use("example", 'test', 'console', function (Y) {
var testCase = new Y.Test.Case({
testFoo : function () {
Y.Assert.areEqual('foo', Y.example, 'Y.example should be "foo"');
}
});
new Y.Console({
newestOnTop : false,
style: 'block'
}).render('#console');
Y.Test.Runner.add(testCase).run();
});
</script>
</body>
</html>
@Marzelpan
Copy link

Line 22 of test_example.html should be
Y.Assert.areEqual('foo', Y.example, 'Y.example should be "foo"');

@erikeldridge
Copy link
Author

Thanks, Marzelpan. Updating code ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment