mirror of
				https://gitea.com/Lydanne/buildx.git
				synced 2025-11-04 01:53:42 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			30 lines
		
	
	
		
			723 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			723 B
		
	
	
	
		
			Go
		
	
	
	
	
	
package tests
 | 
						|
 | 
						|
import (
 | 
						|
	"testing"
 | 
						|
 | 
						|
	"github.com/moby/buildkit/util/testutil/integration"
 | 
						|
	"github.com/stretchr/testify/require"
 | 
						|
)
 | 
						|
 | 
						|
var commonTests = []func(t *testing.T, sb integration.Sandbox){
 | 
						|
	testUnknownCommand,
 | 
						|
	testUnknownFlag,
 | 
						|
}
 | 
						|
 | 
						|
func testUnknownCommand(t *testing.T, sb integration.Sandbox) {
 | 
						|
	cmd := buildxCmd(sb, withArgs("foo"))
 | 
						|
	out, err := cmd.CombinedOutput()
 | 
						|
	require.Error(t, err, string(out))
 | 
						|
 | 
						|
	cmd = buildxCmd(sb, withArgs("imagetools", "foo"))
 | 
						|
	out, err = cmd.CombinedOutput()
 | 
						|
	require.Error(t, err, string(out))
 | 
						|
}
 | 
						|
 | 
						|
func testUnknownFlag(t *testing.T, sb integration.Sandbox) {
 | 
						|
	cmd := buildxCmd(sb, withArgs("build", "--foo=bar"))
 | 
						|
	out, err := cmd.CombinedOutput()
 | 
						|
	require.Error(t, err, string(out))
 | 
						|
}
 |