Commit 5273a78d authored by Nigel Tao's avatar Nigel Tao

webdav: skip XML-related tests on Go 1.4.

Package webdav requires the Go standard library's encoding/xml package version
1.5 or greater.

Fixes #10904

Change-Id: Idf2915e581f4efa6f00e7701785ea258f9e1a8f4
Reviewed-on: https://go-review.googlesource.com/10243Reviewed-by: 's avatarRobert Stepanek <robert.stepanek@gmail.com>
Reviewed-by: 's avatarNigel Tao <nigeltao@golang.org>
parent bb64f4dc
...@@ -12,12 +12,34 @@ import ( ...@@ -12,12 +12,34 @@ import (
"errors" "errors"
"fmt" "fmt"
"io" "io"
"log"
"net/http" "net/http"
"net/url" "net/url"
"os" "os"
"runtime"
"strings"
"time" "time"
) )
// Package webdav's XML output requires the standard library's encoding/xml
// package version 1.5 or greater. Otherwise, it will produce malformed XML.
//
// As of May 2015, the Go stable release is version 1.4, so we print a message
// to let users know that this golang.org/x/etc package won't work yet.
//
// This package also won't work with Go 1.3 and earlier, but making this
// runtime version check catch all the earlier versions too, and not just
// "1.4.x", isn't worth the complexity.
//
// TODO: delete this check at some point after Go 1.5 is released.
var go1Dot4 = strings.HasPrefix(runtime.Version(), "go1.4.")
func init() {
if go1Dot4 {
log.Println("package webdav requires Go version 1.5 or greater")
}
}
type Handler struct { type Handler struct {
// FileSystem is the virtual file system. // FileSystem is the virtual file system.
FileSystem FileSystem FileSystem FileSystem
......
...@@ -345,6 +345,10 @@ func TestReadPropfind(t *testing.T) { ...@@ -345,6 +345,10 @@ func TestReadPropfind(t *testing.T) {
} }
func TestMultistatusWriter(t *testing.T) { func TestMultistatusWriter(t *testing.T) {
if go1Dot4 {
t.Skip("TestMultistatusWriter requires Go version 1.5 or greater")
}
///The "section x.y.z" test cases come from section x.y.z of the spec at ///The "section x.y.z" test cases come from section x.y.z of the spec at
// http://www.webdav.org/specs/rfc4918.html // http://www.webdav.org/specs/rfc4918.html
testCases := []struct { testCases := []struct {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment