normalize_test.go raw

   1  package normalize
   2  
   3  import (
   4  	"fmt"
   5  	"testing"
   6  )
   7  
   8  func TestURL(t *testing.T) {
   9  	fmt.Println(URL([]byte("")))
  10  	fmt.Println(URL([]byte("wss://x.com/y")))
  11  	fmt.Println(URL([]byte("wss://x.com/y/")))
  12  	fmt.Println(URL([]byte("http://x.com/y")))
  13  	fmt.Println(URL(URL([]byte("http://x.com/y"))))
  14  	fmt.Println(URL([]byte("wss://x.com")))
  15  	fmt.Println(URL([]byte("wss://x.com/")))
  16  	fmt.Println(URL(URL(URL([]byte("wss://x.com/")))))
  17  	fmt.Println(URL([]byte("x.com")))
  18  	fmt.Println(URL([]byte("x.com/")))
  19  	fmt.Println(URL([]byte("x.com////")))
  20  	fmt.Println(URL([]byte("x.com/?x=23")))
  21  
  22  	// Output:
  23  	//
  24  	// wss://x.com/y
  25  	// wss://x.com/y
  26  	// ws://x.com/y
  27  	// ws://x.com/y
  28  	// wss://x.com
  29  	// wss://x.com
  30  	// wss://x.com
  31  	// wss://x.com
  32  	// wss://x.com
  33  	// wss://x.com
  34  	// wss://x.com?x=23
  35  }
  36