@@ -90,7 +90,7 @@ test('reading more lines than are in the file (with trailing newline)', t => {
9090 t . is ( result . toString ( ) , 'short2\nshort1\n' ) ; // these files only have one line (with \n)
9191} ) ;
9292
93- test ( 'Globbed file' , t => {
93+ test ( 'globbed file' , t => {
9494 const result = shell . tail ( 'test/resources/head/file?.txt' ) ;
9595 t . falsy ( shell . error ( ) ) ;
9696 t . is ( result . code , 0 ) ;
@@ -102,7 +102,7 @@ test('Globbed file', t => {
102102 . join ( '\n' ) + '\n' ) ;
103103} ) ;
104104
105- test ( 'With `\'-n\' <num>` option' , t => {
105+ test ( 'with `\'-n\' <num>` option' , t => {
106106 const result = shell . tail ( '-n' , 4 , 'test/resources/head/file2.txt' ,
107107 'test/resources/head/file1.txt' ) ;
108108 t . falsy ( shell . error ( ) ) ;
@@ -115,7 +115,20 @@ test('With `\'-n\' <num>` option', t => {
115115 . join ( '\n' ) + '\n' ) ;
116116} ) ;
117117
118- test ( 'With `{\'-n\': <num>}` option' , t => {
118+ test ( 'with `\'-n\' +<num>` option' , t => {
119+ const result = shell . tail ( '-n' , '+48' , 'test/resources/head/file2.txt' ,
120+ 'test/resources/head/file1.txt' ) ;
121+ t . falsy ( shell . error ( ) ) ;
122+ t . is ( result . code , 0 ) ;
123+ t . is ( result . toString ( ) ,
124+ bottomOfFile2
125+ . slice ( 0 , 3 )
126+ . reverse ( )
127+ . concat ( bottomOfFile1 . slice ( 0 , 3 ) . reverse ( ) )
128+ . join ( '\n' ) + '\n' ) ;
129+ } ) ;
130+
131+ test ( 'with `{\'-n\': <num>}` option' , t => {
119132 const result = shell . tail ( { '-n' : 4 } , 'test/resources/head/file2.txt' ,
120133 'test/resources/head/file1.txt' ) ;
121134 t . falsy ( shell . error ( ) ) ;
@@ -128,6 +141,19 @@ test('With `{\'-n\': <num>}` option', t => {
128141 . join ( '\n' ) + '\n' ) ;
129142} ) ;
130143
144+ test ( 'with `{\'-n\': +<num>}` option' , t => {
145+ const result = shell . tail ( { '-n' : '+48' } , 'test/resources/head/file2.txt' ,
146+ 'test/resources/head/file1.txt' ) ;
147+ t . falsy ( shell . error ( ) ) ;
148+ t . is ( result . code , 0 ) ;
149+ t . is ( result . toString ( ) ,
150+ bottomOfFile2
151+ . slice ( 0 , 3 )
152+ . reverse ( )
153+ . concat ( bottomOfFile1 . slice ( 0 , 3 ) . reverse ( ) )
154+ . join ( '\n' ) + '\n' ) ;
155+ } ) ;
156+
131157test ( 'negative values are the same as positive values' , t => {
132158 const result = shell . tail ( '-n' , - 4 , 'test/resources/head/file2.txt' ,
133159 'test/resources/head/file1.txt' ) ;
0 commit comments