Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80555 views
1
var test = require('tape');
2
var expand = require('..');
3
4
test('numeric sequences', function(t) {
5
t.deepEqual(expand('a{1..2}b{2..3}c'), [
6
'a1b2c', 'a1b3c', 'a2b2c', 'a2b3c'
7
]);
8
t.deepEqual(expand('{1..2}{2..3}'), [
9
'12', '13', '22', '23'
10
]);
11
t.end();
12
});
13
14
test('numeric sequences with step count', function(t) {
15
t.deepEqual(expand('{0..8..2}'), [
16
'0', '2', '4', '6', '8'
17
]);
18
t.deepEqual(expand('{1..8..2}'), [
19
'1', '3', '5', '7'
20
]);
21
t.end();
22
});
23
24
test('numeric sequence with negative x / y', function(t) {
25
t.deepEqual(expand('{3..-2}'), [
26
'3', '2', '1', '0', '-1', '-2'
27
]);
28
t.end();
29
});
30
31
test('alphabetic sequences', function(t) {
32
t.deepEqual(expand('1{a..b}2{b..c}3'), [
33
'1a2b3', '1a2c3', '1b2b3', '1b2c3'
34
]);
35
t.deepEqual(expand('{a..b}{b..c}'), [
36
'ab', 'ac', 'bb', 'bc'
37
]);
38
t.end();
39
});
40
41
test('alphabetic sequences with step count', function(t) {
42
t.deepEqual(expand('{a..k..2}'), [
43
'a', 'c', 'e', 'g', 'i', 'k'
44
]);
45
t.deepEqual(expand('{b..k..2}'), [
46
'b', 'd', 'f', 'h', 'j'
47
]);
48
t.end();
49
});
50
51
52