Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for GOARCH=wasm (include GOOS=wasip1) #168

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions termenv_other.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build js || plan9 || aix
// +build js plan9 aix
//go:build wasm || plan9 || aix
// +build wasm plan9 aix

package termenv

Expand Down
21 changes: 19 additions & 2 deletions termenv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,22 @@ import (
"image/color"
"io"
"os"
"runtime"
"strings"
"testing"
"text/template"
)

const isOtherPlatform = runtime.GOOS == "plan9" || runtime.GOOS == "aix" || runtime.GOARCH == "wasm"

func TestLegacyTermEnv(t *testing.T) {
p := ColorProfile()
if p != TrueColor && p != Ascii {

if isOtherPlatform {
if p != ANSI256 {
t.Errorf("Expected %d, got %d", ANSI256, p)
}
} else if p != TrueColor && p != Ascii {
t.Errorf("Expected %d, got %d", TrueColor, p)
}

Expand All @@ -36,7 +44,12 @@ func TestLegacyTermEnv(t *testing.T) {

func TestTermEnv(t *testing.T) {
o := NewOutput(os.Stdout)
if o.Profile != TrueColor && o.Profile != Ascii {

if isOtherPlatform {
if o.Profile != ANSI256 {
t.Errorf("Expected %d, got %d", ANSI256, o.Profile)
}
} else if o.Profile != TrueColor && o.Profile != Ascii {
t.Errorf("Expected %d, got %d", TrueColor, o.Profile)
}

Expand Down Expand Up @@ -358,6 +371,10 @@ func TestEnvNoColor(t *testing.T) {
}

func TestPseudoTerm(t *testing.T) {
if isOtherPlatform {
t.Skip("does not pass on platforms that default to ANSI256")
}

buf := &bytes.Buffer{}
o := NewOutput(buf)
if o.Profile != Ascii {
Expand Down