1 | gt.module('quote');
|
2 |
|
3 | var quote = require('..');
|
4 |
|
5 | gt.test('quotes a string', function () {
|
6 | gt.equal(quote(''), '""');
|
7 | gt.equal(quote('foo'), '"foo"');
|
8 | gt.equal(quote(quote('foo')), '"foo"');
|
9 | });
|
10 |
|
11 | gt.test('config object', function () {
|
12 | var q = quote({ quotes: '*' });
|
13 | gt.func(q, 'returns a function');
|
14 | gt.equal(q('foo'), '*foo*');
|
15 | gt.equal(q(q('foo')), '*foo*');
|
16 | });
|
17 |
|
18 | gt.test('different options works independently', function () {
|
19 | var wildcards = quote({ quotes: '*' });
|
20 | gt.equal(quote('foo'), '"foo"');
|
21 | gt.equal(wildcards('foo'), '*foo*');
|
22 | var ups = quote({ quotes: '^' });
|
23 | gt.equal(ups('bar'), '^bar^');
|
24 | });
|
25 |
|
26 | gt.test('can be configured multiple times', function () {
|
27 | gt.equal(quote('foo'), '"foo"');
|
28 | var q = quote({ quotes: '^' });
|
29 | gt.equal(q('bar'), '^bar^');
|
30 |
|
31 |
|
32 |
|
33 | });
|