@@ -20,39 +20,39 @@ describe('N3StreamWriter', function () {
2020
2121 describe ( 'An N3StreamWriter instance' , function ( ) {
2222 it ( 'should serialize 0 triples' ,
23- shouldSerialize ( [ ] , '' ) ) ;
23+ shouldSerialize ( '' ) ) ;
2424
2525 it ( 'should serialize 1 triple' ,
26- shouldSerialize ( [ [ 'abc' , 'def' , 'ghi' ] ] ,
26+ shouldSerialize ( [ 'abc' , 'def' , 'ghi' ] ,
2727 '<abc> <def> <ghi>.\n' ) ) ;
2828
2929 it ( 'should serialize 2 triples' ,
30- shouldSerialize ( [ [ 'abc' , 'def' , 'ghi' ] ,
31- [ 'jkl' , 'mno' , 'pqr' ] ] ,
30+ shouldSerialize ( [ 'abc' , 'def' , 'ghi' ] ,
31+ [ 'jkl' , 'mno' , 'pqr' ] ,
3232 '<abc> <def> <ghi>.\n' +
3333 '<jkl> <mno> <pqr>.\n' ) ) ;
3434
3535 it ( 'should serialize 3 triples' ,
36- shouldSerialize ( [ [ 'abc' , 'def' , 'ghi' ] ,
37- [ 'jkl' , 'mno' , 'pqr' ] ,
38- [ 'stu' , 'vwx' , 'yz' ] ] ,
36+ shouldSerialize ( [ 'abc' , 'def' , 'ghi' ] ,
37+ [ 'jkl' , 'mno' , 'pqr' ] ,
38+ [ 'stu' , 'vwx' , 'yz' ] ,
3939 '<abc> <def> <ghi>.\n' +
4040 '<jkl> <mno> <pqr>.\n' +
4141 '<stu> <vwx> <yz>.\n' ) ) ;
4242
4343 it ( 'should not serialize a literal in the subject' ,
44- shouldNotSerialize ( [ [ '"a"' , 'b' , '"c' ] ] ,
44+ shouldNotSerialize ( [ '"a"' , 'b' , '"c' ] ,
4545 'A literal as subject is not allowed: "a"' ) ) ;
4646
4747 it ( 'should not serialize a literal in the predicate' ,
48- shouldNotSerialize ( [ [ 'a' , '"b"' , '"c' ] ] ,
48+ shouldNotSerialize ( [ 'a' , '"b"' , '"c' ] ,
4949 'A literal as predicate is not allowed: "b"' ) ) ;
5050
5151 it ( 'should use prefixes when possible' ,
5252 shouldSerialize ( { prefixes : { a : 'http://a.org/' , b : 'http://a.org/b#' , c : 'http://a.org/b' } } ,
53- [ [ 'http://a.org/bc' , 'http://a.org/b#ef' , 'http://a.org/bhi' ] ,
54- [ 'http://a.org/bc/de' , 'http://a.org/b#e#f' , 'http://a.org/b#x/t' ] ,
55- [ 'http://a.org/3a' , 'http://a.org/b#3a' , 'http://a.org/b#a3' ] ] ,
53+ [ 'http://a.org/bc' , 'http://a.org/b#ef' , 'http://a.org/bhi' ] ,
54+ [ 'http://a.org/bc/de' , 'http://a.org/b#e#f' , 'http://a.org/b#x/t' ] ,
55+ [ 'http://a.org/3a' , 'http://a.org/b#3a' , 'http://a.org/b#a3' ] ,
5656 '@prefix a: <http://a.org/>.\n' +
5757 '@prefix b: <http://a.org/b#>.\n\n' +
5858 'a:bc b:ef a:bhi.\n' +
@@ -62,9 +62,11 @@ describe('N3StreamWriter', function () {
6262} ) ;
6363
6464
65- function shouldSerialize ( options , tripleArrays , expectedResult ) {
66- if ( ! expectedResult )
67- expectedResult = tripleArrays , tripleArrays = options , options = null ;
65+ function shouldSerialize ( /* options?, tripleArrays..., expectedResult */ ) {
66+ var tripleArrays = Array . prototype . slice . call ( arguments ) ,
67+ expectedResult = tripleArrays . pop ( ) ,
68+ options = tripleArrays [ 0 ] instanceof Array ? null : tripleArrays . shift ( ) ;
69+
6870 return function ( done ) {
6971 var inputStream = new ArrayReader ( tripleArrays ) ,
7072 transform = new N3StreamWriter ( options ) ,
@@ -79,7 +81,10 @@ function shouldSerialize(options, tripleArrays, expectedResult) {
7981 } ;
8082}
8183
82- function shouldNotSerialize ( tripleArrays , expectedMessage ) {
84+ function shouldNotSerialize ( /* tripleArrays..., expectedMessage */ ) {
85+ var tripleArrays = Array . prototype . slice . call ( arguments ) ,
86+ expectedMessage = tripleArrays . pop ( ) ;
87+
8388 return function ( done ) {
8489 var inputStream = new ArrayReader ( tripleArrays ) ,
8590 transform = new N3StreamWriter ( ) ,
0 commit comments