github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/igm/sockjs-go.v2/sockjs/utils_test.go (about)

     1  package sockjs
     2  
     3  import "testing"
     4  
     5  func TestQuote(t *testing.T) {
     6  	var quotationTests = []struct {
     7  		input  string
     8  		output string
     9  	}{
    10  		{"simple", "\"simple\""},
    11  		{"more complex \"", "\"more complex \\\"\""},
    12  	}
    13  
    14  	for _, testCase := range quotationTests {
    15  		if quote(testCase.input) != testCase.output {
    16  			t.Errorf("Expected '%s', got '%s'", testCase.output, quote(testCase.input))
    17  		}
    18  	}
    19  }