github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/tests/os/smoke/smoke_test.go (about)

     1  package os_smoke_test
     2  
     3  // Simple smoke tests for the os package or things that depend on it.
     4  // Intended to catch build tag mistakes affecting bare metal targets.
     5  
     6  import (
     7  	"fmt"
     8  	"path/filepath"
     9  	"testing"
    10  )
    11  
    12  // Regression test for https://github.com/tinygo-org/tinygo/issues/2563
    13  func TestFilepath(t *testing.T) {
    14  	if filepath.Base("foo/bar") != "bar" {
    15  		t.Errorf("filepath.Base is very confused")
    16  	}
    17  }
    18  
    19  // Regression test for https://github.com/tinygo-org/tinygo/issues/2530
    20  func TestFmt(t *testing.T) {
    21  	n, err := fmt.Printf("Hello, world!\n")
    22  	if err != nil {
    23  		t.Errorf("printf returned error %s", err)
    24  	} else if n != 14 {
    25  		t.Errorf("printf returned %d, expected 14", n)
    26  	}
    27  }