-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutil_replace_test.go
More file actions
56 lines (48 loc) · 1.24 KB
/
util_replace_test.go
File metadata and controls
56 lines (48 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package goxc_test
import (
"testing"
"github.com/openyard/goxc"
)
var namespaces = map[string]string{
"xs": "http://www.w3.org/2001/XMLSchema",
"foo": "http://foo",
"bar": "http://bar",
}
func TestWithTargetPrefix(t *testing.T) {
n := goxc.Replace("foo", "foo:Bar", namespaces)
if "Bar" != n {
t.Errorf("expected 'Bar' got '%s'", n)
}
}
func TestWithOtherPrefix(t *testing.T) {
n := goxc.Replace("foo", "bar:Bar", namespaces)
if "bar.Bar" != n {
t.Errorf("expected 'bar.Bar' got '%s'", n)
}
}
func TestWithBaseTypePrefix(t *testing.T) {
n := goxc.Replace("foo", "w3c.Bar", namespaces)
if "w3c.Bar" != n {
t.Errorf("expected 'bar.Bar' got '%s'", n)
}
}
func TestWithWithoutPrefix(t *testing.T) {
n := goxc.Replace("", "boolean", namespaces)
if "w3c.Boolean" != n {
t.Errorf("expected 'w3c.Boolean' got '%s'", n)
}
n = goxc.Replace("", "string", namespaces)
if "w3c.String" != n {
t.Errorf("expected 'w3c.String' got '%s'", n)
}
}
func TestWithWithDifferentW3CPrefix(t *testing.T) {
n := goxc.Replace("", "xs:boolean", namespaces)
if "w3c.Boolean" != n {
t.Errorf("expected 'w3c.Boolean' got '%s'", n)
}
n = goxc.Replace("", "xs:string", namespaces)
if "w3c.String" != n {
t.Errorf("expected 'w3c.String' got '%s'", n)
}
}