github.com/nuvolaris/goja@v0.0.0-20230825100449-967811910c6d/unistring/string_test.go (about)

     1  package unistring
     2  
     3  import "testing"
     4  
     5  func TestString_AsUtf16(t *testing.T) {
     6  	const str = "más"
     7  	s := NewFromString(str)
     8  
     9  	if b := s.AsUtf16(); len(b) != 4 || b[0] != BOM {
    10  		t.Fatal(b)
    11  	}
    12  
    13  	if s.String() != str {
    14  		t.Fatal(s)
    15  	}
    16  }