a73x

internal/smoke/coverage_test.go

Ref:   Size: 909 B   History

package smoke

import (
	"slices"
	"testing"
)

func TestCovdataMergeArgs(t *testing.T) {
	got := covdataMergeArgs([]string{"/cov/server", "/cov/agent"}, "/cov/out")
	want := []string{"tool", "covdata", "merge", "-i=/cov/server,/cov/agent", "-o=/cov/out"}
	if !slices.Equal(got, want) {
		t.Fatalf("covdataMergeArgs = %v, want %v", got, want)
	}
}

func TestCovdataMergeArgsSingleInput(t *testing.T) {
	got := covdataMergeArgs([]string{"/only"}, "/out")
	want := []string{"tool", "covdata", "merge", "-i=/only", "-o=/out"}
	if !slices.Equal(got, want) {
		t.Fatalf("covdataMergeArgs = %v, want %v", got, want)
	}
}

func TestCovdataTextfmtArgs(t *testing.T) {
	got := covdataTextfmtArgs("/cov/out", "/cov/out/coverage.txt")
	want := []string{"tool", "covdata", "textfmt", "-i=/cov/out", "-o=/cov/out/coverage.txt"}
	if !slices.Equal(got, want) {
		t.Fatalf("covdataTextfmtArgs = %v, want %v", got, want)
	}
}