Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestEscape (0.08 sec)

  1. src/html/template/escape_test.go

    	return []byte("{ foo: 'not quite valid JSON' }"), nil
    }
    
    type goodMarshaler struct{}
    
    func (x *goodMarshaler) MarshalJSON() ([]byte, error) {
    	return []byte(`{ "<foo>": "O'Reilly" }`), nil
    }
    
    func TestEscape(t *testing.T) {
    	data := struct {
    		F, T       bool
    		C, G, H, I string
    		A, E       []string
    		B, M       json.Marshaler
    		N          int
    		U          any  // untyped nil
    		Z          *int // typed nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Oct 16 03:29:27 UTC 2023
    - 56.2K bytes
    - Viewed (0)
  2. src/encoding/json/decode_test.go

    	pxint := &xint
    	if err := Unmarshal([]byte(`{"X":1}`), &pxint); err != nil {
    		t.Fatalf("Unmarshal: %v", err)
    	}
    	if xint.X != 1 {
    		t.Fatalf("xint.X = %d, want 1", xint.X)
    	}
    }
    
    func TestEscape(t *testing.T) {
    	const input = `"foobar"<html>` + " [\u2028 \u2029]"
    	const want = `"\"foobar\"\u003chtml\u003e [\u2028 \u2029]"`
    	got, err := Marshal(input)
    	if err != nil {
    		t.Fatalf("Marshal error: %v", err)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Apr 11 16:40:14 UTC 2024
    - 67.6K bytes
    - Viewed (0)
Back to top