@@ -9,24 +9,53 @@ tape('should parse a Dockerfile', function (t) {
99 var commands = dockerfileParser . parse ( dockerFile ) ;
1010
1111 var numCommands = 15 ;
12- t . assert ( commands . length === numCommands , 'Check number of commands' ) ;
12+ t . equal ( commands . length , numCommands , 'Check number of commands' ) ;
1313
1414 var from = commands [ 0 ] ;
15- t . assert ( from . name === 'FROM' , 'First command should be FROM' ) ;
15+ t . equal ( from . name , 'FROM' , 'First command should be FROM' ) ;
1616
1717 var add = commands [ 1 ] ;
18- t . assert ( add . name === 'ADD' , 'Check ADD command' ) ;
19- t . assert ( add . args [ 0 ] === '.' , 'Check ADD first arg' ) ;
20- t . assert ( add . args [ 1 ] === '/srv/app' , 'Check ADD second arg' ) ;
18+ t . equal ( add . name , 'ADD' , 'Check ADD command' ) ;
19+ t . equal ( add . args [ 0 ] , '.' , 'Check ADD first arg' ) ;
20+ t . equal ( add . args [ 1 ] , '/srv/app' , 'Check ADD second arg' ) ;
2121
2222 var env = commands [ 7 ] ;
23- t . assert ( env . name === 'ENV' , '8th command is ENV' ) ;
24- t . assert ( Object . keys ( env . args ) . length === 2 , 'ENV command has 2 keys' ) ;
25- t . assert ( env . args [ 'VAR2' ] === '20' , 'ENV VAR2 check' ) ;
26- t . assert ( env . args [ 'VAR3' ] === '30' , 'ENV VAR3 check' ) ;
23+ t . equal ( env . name , 'ENV' , '8th command is ENV' ) ;
24+ t . equal ( Object . keys ( env . args ) . length , 2 , 'ENV command has 2 keys' ) ;
25+ t . equal ( env . args [ 'VAR2' ] , '20' , 'ENV VAR2 check' ) ;
26+ t . equal ( env . args [ 'VAR3' ] , '30' , 'ENV VAR3 check' ) ;
2727
28- t . assert ( commands [ numCommands - 1 ] . name === 'ENTRYPOINT' ,
28+ t . equal ( commands [ numCommands - 1 ] . name , 'ENTRYPOINT' ,
2929 'Last command should be ENTRYPOINT' ) ;
3030
3131 t . end ( ) ;
3232} ) ;
33+
34+
35+ tape ( 'mesos Dockerfile' , function ( t ) {
36+
37+ var dname = __dirname ;
38+ var dockerFile = fs . readFileSync ( dname + '/mesos/Dockerfile' , 'utf8' ) ;
39+ var commands = dockerfileParser . parse ( dockerFile ) ;
40+
41+ t . equal ( commands . length , 18 , 'Check number of commands' ) ;
42+ t . equal ( commands [ 0 ] . name , 'FROM' , 'First command should be FROM' ) ;
43+ t . equal ( commands [ 17 ] . name , 'WORKDIR' , 'Last command should be WORKDIR' ) ;
44+
45+ t . end ( ) ;
46+ } ) ;
47+
48+
49+ tape ( 'case insensitive' , function ( t ) {
50+
51+ var dname = __dirname ;
52+ var dockerFile = fs . readFileSync ( dname + '/caseTest' , 'utf8' ) ;
53+ var commands = dockerfileParser . parse ( dockerFile ) ;
54+
55+ t . equal ( commands . length , 3 , 'Check number of commands' ) ;
56+ t . equal ( commands [ 0 ] . name , 'FROM' , 'Command should be FROM' ) ;
57+ t . equal ( commands [ 1 ] . name , 'ADD' , 'Command should be ADD' ) ;
58+ t . equal ( commands [ 2 ] . name , 'COPY' , 'Command should be COPY' ) ;
59+
60+ t . end ( ) ;
61+ } ) ;
0 commit comments