update and fix tests
This commit is contained in:
parent
2f98800715
commit
ca05f24a6a
1 changed files with 34 additions and 33 deletions
|
@ -41,24 +41,24 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
statement <s> Statement
|
||||
type <s> Type of the item
|
||||
<script>
|
||||
Ox.test.doc = Ox.doc(
|
||||
'//@ My.FOO <n> Magic constant\n' +
|
||||
'My.FOO = 23;\n' +
|
||||
'\n' +
|
||||
'/*@\n'+
|
||||
'My.foo <f> Returns an items\'s bar per baz\n' +
|
||||
' Bar per baz is a good indicator of an item\'s foo-ness.\n' +
|
||||
' (item) -> <n> Bar per baz, or NaN\n' +
|
||||
' item <o> Any item\n' +
|
||||
' > My.foo({bar: 1, baz: 10})\n' +
|
||||
' 0.1\n' +
|
||||
' > My.foo({})\n' +
|
||||
' NaN\n' +
|
||||
'@*' + '/\n' +
|
||||
'My.foo = function(item) {\n' +
|
||||
' return item.bar / item.baz;\n' +
|
||||
Ox.test.doc = Ox.doc([
|
||||
'//@ My.FOO <n> Magic constant',
|
||||
'My.FOO = 23;',
|
||||
'',
|
||||
'/*@',
|
||||
'My.foo <f> Returns an items\'s bar per baz',
|
||||
' Bar per baz is a good indicator of an item\'s foo-ness.',
|
||||
' (item) -> <n> Bar per baz, or NaN',
|
||||
' item <o> Any item',
|
||||
' > My.foo({bar: 1, baz: 10})',
|
||||
' 0.1',
|
||||
' > My.foo({})',
|
||||
' NaN',
|
||||
'@*' + '/',
|
||||
'My.foo = function(item) {',
|
||||
' return item.bar / item.baz;',
|
||||
'};'
|
||||
);
|
||||
].join('\n'));
|
||||
</script>
|
||||
> Ox.test.doc[0].name
|
||||
'My.FOO'
|
||||
|
@ -68,9 +68,9 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
'Magic constant'
|
||||
> Ox.test.doc[1].description
|
||||
'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']
|
||||
> Ox.test.doc[1].signature[0].summary
|
||||
> Ox.test.doc[1].returns[0].summary
|
||||
'Bar per baz, or NaN'
|
||||
> Ox.test.doc[1].tests[1]
|
||||
{expected: 'NaN', statement: 'My.foo({})'}
|
||||
|
@ -625,20 +625,21 @@ Ox.test <f> Takes JavaScript, runs inline tests, returns results
|
|||
Ox.test.foo = function(item) {
|
||||
return item.bar / item.baz;
|
||||
};
|
||||
Ox.test.source =
|
||||
'/*@\n'+
|
||||
'Ox.test.foo <f> Returns an items\'s bar per baz\n' +
|
||||
' Bar per baz is a good indicator of an item\'s foo-ness.\n' +
|
||||
' (item) -> <n> Bar per baz, or NaN\n' +
|
||||
' item <o> Any item\n' +
|
||||
' > Ox.test.foo({bar: 1, baz: 10})\n' +
|
||||
' 0.1\n' +
|
||||
' > Ox.test.foo({})\n' +
|
||||
' NaN\n' +
|
||||
'@*' + '/\n' +
|
||||
'Ox.test.foo = function(item) {\n' +
|
||||
' return item.bar / item.baz;\n' +
|
||||
'};';
|
||||
Ox.test.source = [
|
||||
'/*@',
|
||||
'Ox.test.foo <f> Returns an items\'s bar per baz',
|
||||
' Bar per baz is a good indicator of an item\'s foo-ness.',
|
||||
' (item) -> <n> Bar per baz, or NaN',
|
||||
' item <o> Any item',
|
||||
' > Ox.test.foo({bar: 1, baz: 10})',
|
||||
' 0.1',
|
||||
' > Ox.test.foo({})',
|
||||
' NaN',
|
||||
'@*' + '/',
|
||||
'Ox.test.foo = function(item) {',
|
||||
' return item.bar / item.baz;',
|
||||
'};'
|
||||
].join('\n');
|
||||
</script>
|
||||
> Ox.test(Ox.test.source, function(r) { Ox.test(r[0].passed, true); })
|
||||
undefined
|
||||
|
|
Loading…
Reference in a new issue