@@ -21,8 +21,10 @@ test('Check if entry will be appended', co.wrap(function* (t) {
2121 const filePath = path . resolve ( testSrcPath , 'list1.txt' ) ;
2222 const content = fs . readFileSync ( filePath ) . toString ( ) ;
2323
24- t . is ( ( content . match ( / M a r c o / g) || [ ] ) . length , 1 ) ;
25- t . is ( ( content . match ( / P o l o / g) || [ ] ) . length , 1 ) ;
24+ t . is ( ( content . match ( / M a r c o 1 / g) || [ ] ) . length , 1 ) ;
25+ t . is ( ( content . match ( / P o l o 1 / g) || [ ] ) . length , 1 ) ;
26+ t . is ( ( content . match ( / M a r c o 2 / g) || [ ] ) . length , 1 ) ;
27+ t . is ( ( content . match ( / P o l o 2 / g) || [ ] ) . length , 1 ) ;
2628} ) ) ;
2729
2830test ( 'Check if duplicates get filtered' , co . wrap ( function * ( t ) {
@@ -34,8 +36,10 @@ test('Check if duplicates get filtered', co.wrap(function* (t) {
3436 const filePath = path . resolve ( testSrcPath , 'list2.txt' ) ;
3537 const content = fs . readFileSync ( filePath ) . toString ( ) ;
3638
37- t . is ( ( content . match ( / M a r c o / g) || [ ] ) . length , 1 ) ;
38- t . is ( ( content . match ( / P o l o / g) || [ ] ) . length , 1 ) ;
39+ t . is ( ( content . match ( / M a r c o 1 / g) || [ ] ) . length , 1 ) ;
40+ t . is ( ( content . match ( / P o l o 1 / g) || [ ] ) . length , 1 ) ;
41+ t . is ( ( content . match ( / M a r c o 2 / g) || [ ] ) . length , 1 ) ;
42+ t . is ( ( content . match ( / P o l o 2 / g) || [ ] ) . length , 1 ) ;
3943} ) ) ;
4044
4145test ( 'Check if duplicates are kept, if allowed' , co . wrap ( function * ( t ) {
@@ -46,8 +50,10 @@ test('Check if duplicates are kept, if allowed', co.wrap(function* (t) {
4650 const filePath = path . resolve ( testSrcPath , 'list3.txt' ) ;
4751 const content = fs . readFileSync ( filePath ) . toString ( ) ;
4852
49- t . is ( ( content . match ( / M a r c o / g) || [ ] ) . length , 2 ) ;
50- t . is ( ( content . match ( / P o l o / g) || [ ] ) . length , 1 ) ;
53+ t . is ( ( content . match ( / M a r c o 1 / g) || [ ] ) . length , 2 ) ;
54+ t . is ( ( content . match ( / P o l o 1 / g) || [ ] ) . length , 1 ) ;
55+ t . is ( ( content . match ( / M a r c o 2 / g) || [ ] ) . length , 2 ) ;
56+ t . is ( ( content . match ( / P o l o 2 / g) || [ ] ) . length , 1 ) ;
5157} ) ) ;
5258
5359test ( 'Check if duplicates are only removed below the pattern' , co . wrap ( function * ( t ) {
@@ -59,6 +65,11 @@ test('Check if duplicates are only removed below the pattern', co.wrap(function*
5965 const filePath = path . resolve ( testSrcPath , 'list4.txt' ) ;
6066 const content = fs . readFileSync ( filePath ) . toString ( ) ;
6167
62- t . is ( ( content . match ( / P l o p / g) || [ ] ) . length , 2 ) ;
63- t . is ( ( content . match ( / P o l o / g) || [ ] ) . length , 1 ) ;
68+ t . is ( ( content . match ( / P l o p 1 / g) || [ ] ) . length , 1 ) ;
69+ t . is ( ( content . match ( / P o l o 1 / g) || [ ] ) . length , 1 ) ;
70+ t . is ( ( content . match ( / P l o p 2 / g) || [ ] ) . length , 1 ) ;
71+ t . is ( ( content . match ( / P o l o 2 / g) || [ ] ) . length , 1 ) ;
72+
73+ // there's a plop at the top
74+ t . is ( ( content . match ( / P l o p / g) || [ ] ) . length , 3 ) ;
6475} ) ) ;
0 commit comments