@@ -32,7 +32,7 @@ func Test_Editorconfig(t *testing.T) {
3232
3333	t .Run ("Test_mounted_host_directory_without_git_directory" , func (t  * testing.T ) {
3434		t .Parallel ()
35- 		container  :=  base (c )
35+ 		container  :=  base ("" )
3636		require .NotNil (t , container )
3737
3838		dir , err  :=  os .Getwd ()
@@ -44,45 +44,49 @@ func Test_Editorconfig(t *testing.T) {
4444				Exclude : []string {".git" },
4545			})).
4646			WithWorkdir ("/tmp" ).
47- 			WithExec ([]string {"/editorconfig-checker " , "-dry-run" }).
47+ 			WithExec ([]string {"ec " , "-dry-run" }).
4848			Stdout (ctx )
4949		require .NoError (t , err )
5050		require .NotNil (t , out )
51+ 		require .NotRegexp (t , `\.git/` , out )
5152	})
5253	t .Run ("Test_mounted_host_directory" , func (t  * testing.T ) {
5354		t .Parallel ()
54- 		container  :=  base (c )
55+ 		container  :=  base ("" )
5556		require .NotNil (t , container )
5657
5758		out , err  :=  container .
5859			WithMountedDirectory ("/tmp" , c .Host ().Directory ("./test/testdata/" )).
5960			WithWorkdir ("/tmp" ).
60- 			WithExec ([]string {"/editorconfig-checker " , "-dry-run" }).
61+ 			WithExec ([]string {"ec " , "-dry-run" }).
6162			Stdout (ctx )
6263		require .NoError (t , err )
63- 		require .Contains (t , out ,  "t .txt" 
64+ 		require .Regexp (t , `t\ .txt` ,  out )
6465	})
65- 	t .Run ("Test_editorconfig_checker_help " , func (t  * testing.T ) {
66+ 	t .Run ("Test_editorconfig-checker_help " , func (t  * testing.T ) {
6667		t .Parallel ()
67- 		container  :=  base (c )
68+ 		container  :=  base ("" )
6869		require .NotNil (t , container )
6970
7071		_ , err  :=  container .
71- 			WithExec ([]string {"/editorconfig-checker " , "-help" }).
72- 			Stdout (ctx )
72+ 			WithExec ([]string {"ec " , "-help" }).
73+ 			Stderr (ctx )
7374		require .NoError (t , err )
7475	})
7576}
7677
77- func  base (c  * dagger.Client ) * dagger.Container  {
78- 	install  :=  c .
79- 		Container ().
80- 		From ("golang:alpine" ).
81- 		WithExec ([]string {
82- 			"go" , "install" ,
83- 			"github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@latest" ,
84- 		})
85- 
86- 	return  c .Container ().
87- 		WithFile ("/" , install .File ("/go/bin/editorconfig-checker" ))
78+ func  base (
79+ 	image  string ,
80+ ) * dagger.Container  {
81+ 
82+ 	defaultImageRepository  :=  "mstruebing/editorconfig-checker" 
83+ 	var  ctr  * dagger.Container 
84+ 
85+ 	if  image  !=  ""  {
86+ 		ctr  =  c .Container ().From (image )
87+ 	} else  {
88+ 		ctr  =  c .Container ().From (defaultImageRepository )
89+ 	}
90+ 
91+ 	return  ctr 
8892}
0 commit comments