Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Pennebaker committed Oct 22, 2024
1 parent 6f5f7e6 commit 111b492
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
12 changes: 2 additions & 10 deletions magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package main
import (
"fmt"
"os"
"os/exec"

"github.com/magefile/mage/mg"
mageextras "github.com/mcandre/mage-extras"
Expand Down Expand Up @@ -33,15 +32,8 @@ func Audit() error {
return DockerScout()
}

// Test executes the integration test suite.
func Test() error {
mg.Deps(Install)

cmd := exec.Command("tug", "-version")
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
return cmd.Run()
}
// Test runs a test suite.
func Test() error { return mageextras.UnitTest() }

// Deadcode runs deadcode.
func Deadcode() error { return mageextras.Deadcode("./...") }
Expand Down
22 changes: 22 additions & 0 deletions platform_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package tug_test

import (
"github.com/mcandre/tug"

"testing"
)

func TestPlatformMarshalingSymmetric(t *testing.T) {
platformString := "linux/arm64"
platform, err := tug.ParsePlatform(platformString)

if err != nil {
t.Error(err)
}

platformString2 := platform.Format()

if platformString2 != platformString {
t.Errorf("expected symmetric marshaling for platform %v", platformString)
}
}

0 comments on commit 111b492

Please sign in to comment.