Riot.js 快速的JavaScript单元测试框架
作者:bea
http://github.com/alexyoung/riotjs示例: Ruby代码 代码如下: context "a new user" do setup { User.new } asserts("that it is not yet created") { topic.new_record? } end context "a new user" do setup { User.new } asserts("that it is not yet c
http://github.com/alexyoung/riotjs
示例:
Ruby代码
代码如下:
context "a new user" do
setup { User.new }
asserts("that it is not yet created") { topic.new_record? }
end
context "a new user" do
setup { User.new }
asserts("that it is not yet created") { topic.new_record? }
end
Javascript代码
代码如下:
Riot.run(function() {
context('basic riot functionality', function() {
given('some simple equality tests', function() {
asserts('a simple truth test should return true', true).isTrue();
asserts('isNull is null', null).isNull();
});
given('another context', function() {
asserts('equals should compare strings as expected', 'test string').equals('test string');
});
given('a context concerned with functions', function() {
asserts('asserts() should allow functions to be compared', function() {
return 'test string';
}).equals('test string');
});
});
given('yet another context', function() {
asserts('equals should compare strings as expected', 'test string').equals('test string');
});
});
有用 | 无用
示例:
Ruby代码
代码如下:
context "a new user" do
setup { User.new }
asserts("that it is not yet created") { topic.new_record? }
end
context "a new user" do
setup { User.new }
asserts("that it is not yet created") { topic.new_record? }
end
Javascript代码
代码如下:
Riot.run(function() {
context('basic riot functionality', function() {
given('some simple equality tests', function() {
asserts('a simple truth test should return true', true).isTrue();
asserts('isNull is null', null).isNull();
});
given('another context', function() {
asserts('equals should compare strings as expected', 'test string').equals('test string');
});
given('a context concerned with functions', function() {
asserts('asserts() should allow functions to be compared', function() {
return 'test string';
}).equals('test string');
});
});
given('yet another context', function() {
asserts('equals should compare strings as expected', 'test string').equals('test string');
});
});
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- 把html页面的部分内容保存成新的html文件的jquery代码
- Javascript 定时器调用传递参数的方法
- Ext.FormPanel 提交和 Ext.Ajax.request 异步提交函数的区别
- JS解析XML的实现代码
- 跨域表单提交状态的变相判断代码
- JS 中document.URL 和 windows.location.href 的区别
- ASP中进行HTML数据及JS数据编码函数
- javascript 日期常用的方法
- Jquery在IE7下无法使用 $.ajax解决方法
- jQuery 白痴级入门教程
- Javascript 解疑
- 不一样的文字闪烁 轮番闪烁
- JS旋转的彩色文字轮转特效
- 文字来回上下移动或跳动的代码
- jquery 输入框数字限制插件
- 通过隐藏option实现select的联动效果
- javascript实现的鼠标悬停时动态翻滚的导航条
- Js 实现表格隔行换色一例
- Javascript实现的CSS代码高亮显示