update and fix tests

This commit is contained in:
rolux 2012-05-30 10:19:30 +02:00
parent 2f98800715
commit ca05f24a6a

View file

@ -41,24 +41,24 @@ Ox.doc <f> Generates documentation for annotated JavaScript
statement <s> Statement statement <s> Statement
type <s> Type of the item type <s> Type of the item
<script> <script>
Ox.test.doc = Ox.doc( Ox.test.doc = Ox.doc([
'//@ My.FOO <n> Magic constant\n' + '//@ My.FOO <n> Magic constant',
'My.FOO = 23;\n' + 'My.FOO = 23;',
'\n' + '',
'/*@\n'+ '/*@',
'My.foo <f> Returns an items\'s bar per baz\n' + 'My.foo <f> Returns an items\'s bar per baz',
' Bar per baz is a good indicator of an item\'s foo-ness.\n' + ' Bar per baz is a good indicator of an item\'s foo-ness.',
' (item) -> <n> Bar per baz, or NaN\n' + ' (item) -> <n> Bar per baz, or NaN',
' item <o> Any item\n' + ' item <o> Any item',
' > My.foo({bar: 1, baz: 10})\n' + ' > My.foo({bar: 1, baz: 10})',
' 0.1\n' + ' 0.1',
' > My.foo({})\n' + ' > My.foo({})',
' NaN\n' + ' NaN',
'@*' + '/\n' + '@*' + '/',
'My.foo = function(item) {\n' + 'My.foo = function(item) {',
' return item.bar / item.baz;\n' + ' return item.bar / item.baz;',
'};' '};'
); ].join('\n'));
</script> </script>
> Ox.test.doc[0].name > Ox.test.doc[0].name
'My.FOO' 'My.FOO'
@ -68,9 +68,9 @@ Ox.doc <f> Generates documentation for annotated JavaScript
'Magic constant' 'Magic constant'
> Ox.test.doc[1].description > Ox.test.doc[1].description
'Bar per baz is a good indicator of an item\'s foo-ness.' 'Bar per baz is a good indicator of an item\'s foo-ness.'
> Ox.test.doc[1].signature[0].types > Ox.test.doc[1].returns[0].types
['number'] ['number']
> Ox.test.doc[1].signature[0].summary > Ox.test.doc[1].returns[0].summary
'Bar per baz, or NaN' 'Bar per baz, or NaN'
> Ox.test.doc[1].tests[1] > Ox.test.doc[1].tests[1]
{expected: 'NaN', statement: 'My.foo({})'} {expected: 'NaN', statement: 'My.foo({})'}
@ -625,20 +625,21 @@ Ox.test <f> Takes JavaScript, runs inline tests, returns results
Ox.test.foo = function(item) { Ox.test.foo = function(item) {
return item.bar / item.baz; return item.bar / item.baz;
}; };
Ox.test.source = Ox.test.source = [
'/*@\n'+ '/*@',
'Ox.test.foo <f> Returns an items\'s bar per baz\n' + 'Ox.test.foo <f> Returns an items\'s bar per baz',
' Bar per baz is a good indicator of an item\'s foo-ness.\n' + ' Bar per baz is a good indicator of an item\'s foo-ness.',
' (item) -> <n> Bar per baz, or NaN\n' + ' (item) -> <n> Bar per baz, or NaN',
' item <o> Any item\n' + ' item <o> Any item',
' > Ox.test.foo({bar: 1, baz: 10})\n' + ' > Ox.test.foo({bar: 1, baz: 10})',
' 0.1\n' + ' 0.1',
' > Ox.test.foo({})\n' + ' > Ox.test.foo({})',
' NaN\n' + ' NaN',
'@*' + '/\n' + '@*' + '/',
'Ox.test.foo = function(item) {\n' + 'Ox.test.foo = function(item) {',
' return item.bar / item.baz;\n' + ' return item.bar / item.baz;',
'};'; '};'
].join('\n');
</script> </script>
> Ox.test(Ox.test.source, function(r) { Ox.test(r[0].passed, true); }) > Ox.test(Ox.test.source, function(r) { Ox.test(r[0].passed, true); })
undefined undefined