gitee.com/quant1x/pkg@v0.2.8/goja/builtin_global_test.go (about)

     1  package goja
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestEncodeURI(t *testing.T) {
     8  	const SCRIPT = `
     9  	encodeURI('тест')
    10  	`
    11  
    12  	testScript(SCRIPT, asciiString("%D1%82%D0%B5%D1%81%D1%82"), t)
    13  }
    14  
    15  func TestDecodeURI(t *testing.T) {
    16  	const SCRIPT = `
    17  	decodeURI("http://ru.wikipedia.org/wiki/%d0%ae%D0%bd%D0%B8%D0%BA%D0%BE%D0%B4")
    18  	`
    19  
    20  	testScript(SCRIPT, newStringValue("http://ru.wikipedia.org/wiki/Юникод"), t)
    21  }