github.com/grahambrereton-form3/tilt@v0.10.18/pkg/model/service_test.go (about)

     1  package model
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestEscapingEntrypoint(t *testing.T) {
     8  	cmd := Cmd{Argv: []string{"bash", "-c", "echo \"hi\""}}
     9  	actual := cmd.EntrypointStr()
    10  	expected := `ENTRYPOINT ["bash", "-c", "echo \"hi\""]`
    11  	if actual != expected {
    12  		t.Fatalf("expected %q, actual %q", expected, actual)
    13  	}
    14  }
    15  
    16  func TestEscapingRun(t *testing.T) {
    17  	cmd := Cmd{Argv: []string{"bash", "-c", "echo \"hi\""}}
    18  	actual := cmd.RunStr()
    19  	expected := `RUN ["bash", "-c", "echo \"hi\""]`
    20  	if actual != expected {
    21  		t.Fatalf("expected %q, actual %q", expected, actual)
    22  	}
    23  }
    24  
    25  func TestNormalFormRun(t *testing.T) {
    26  	cmd := ToShellCmd("echo \"hi\"")
    27  	actual := cmd.RunStr()
    28  	expected := `RUN echo "hi"`
    29  	if actual != expected {
    30  		t.Fatalf("expected %q, actual %q", expected, actual)
    31  	}
    32  }