| 1870 | } |
| 1871 | |
| 1872 | func TestEncodeDecodeDocURL(t *testing.T) { |
| 1873 | input := testProfile1.Copy() |
| 1874 | input.DocURL = "http://example.comp/url" |
| 1875 | |
| 1876 | // Encode/decode. |
| 1877 | var buf bytes.Buffer |
| 1878 | if err := input.Write(&buf); err != nil { |
| 1879 | t.Fatal("encode: ", err) |
| 1880 | } |
| 1881 | output, err := Parse(&buf) |
| 1882 | if err != nil { |
| 1883 | t.Fatal("decode: ", err) |
| 1884 | } |
| 1885 | if want, got := input.String(), output.String(); want != got { |
| 1886 | d, err := proftest.Diff([]byte(want), []byte(got)) |
| 1887 | if err != nil { |
| 1888 | t.Fatal(err) |
| 1889 | } |
| 1890 | t.Errorf("wrong result of encode/decode (-want,+got):\n%s\n", string(d)) |
| 1891 | } |
| 1892 | } |
| 1893 | |
| 1894 | // parallel runs n copies of fn in parallel. |
| 1895 | func parallel(n int, fn func()) { |