33 lines
		
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
		
		
			
		
	
	
			33 lines
		
	
	
		
			517 B
		
	
	
	
		
			Go
		
	
	
	
	
	
|  | package cmdpacks_test | ||
|  | 
 | ||
|  | import ( | ||
|  | 	"testing" | ||
|  | 
 | ||
|  | 	"github.com/stretchr/testify/assert" | ||
|  | ) | ||
|  | 
 | ||
|  | func TestPVars(t *testing.T) { | ||
|  | 	tests := []struct { | ||
|  | 		descr string | ||
|  | 		cmd   string | ||
|  | 	}{ | ||
|  | 		{ | ||
|  | 			descr: "returns item on empty result set", | ||
|  | 			cmd: ` | ||
|  | 				ui:query '"a"="1"' -table service-test-data | ||
|  | 				@item | ||
|  | 			`, | ||
|  | 		}, | ||
|  | 	} | ||
|  | 	for _, tt := range tests { | ||
|  | 		t.Run(tt.descr, func(t *testing.T) { | ||
|  | 			svc := newService(t) | ||
|  | 
 | ||
|  | 			ctx := t.Context() | ||
|  | 
 | ||
|  | 			_, err := svc.CommandController.ExecuteAndWait(ctx, tt.cmd) | ||
|  | 			assert.NoError(t, err) | ||
|  | 		}) | ||
|  | 	} | ||
|  | } |