-
Notifications
You must be signed in to change notification settings - Fork 311
/
Copy pathgen.txtar
116 lines (114 loc) · 3.98 KB
/
gen.txtar
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# generated from the original tests.
# Henceforth it may be nicer to group tests into separate files.
-- in.cue --
import "net"
t1: net.FQDN & "foo.bar."
t2: net.FQDN("foo.bararararararararararararararararararararararararararararararararara")
t3: net.SplitHostPort("[::%lo0]:80")
t4: net.JoinHostPort("mod.test", "80")
t5: net.JoinHostPort("2001:db8::1", 80)
t6: net.JoinHostPort([192, 30, 4, 2], 80)
t7: net.JoinHostPort([192, 30, 4], 80)
t8: net.IP("23.23.23.23")
t9: net.IPv4 & "23.23.23.2333"
t10: net.IP("23.23.23.23")
t11: net.IP("2001:db8::1")
t12: net.IPv4("2001:db8::1")
t13: net.IPv4() & "ff02::1:3"
t14: net.LoopbackIP([127, 0, 0, 1])
t15: net.LoopbackIP("127.0.0.1")
t16: net.ToIP4("127.0.0.1")
t17: net.ToIP16("127.0.0.1")
t18: net.IPCIDR("192.168.1.0/24")
t19: net.IPCIDR("2001:db8:a0b:12f0::1/32")
t20: net.IPCIDR("172.16.12.3")
t21: net.PathEscape("foo/bar")
t22: net.PathUnescape("foo%2Fbar")
t23: net.QueryEscape("f%o")
t24: net.QueryUnescape("f%25o")
t25: net.IPv6 & "2001:db8::1234567"
t26: net.IPv6("2001:db8::1")
t27: net.IPv6() & "23.23.23.23"
t28: net.IP("0:0:0:0:0:0:23.23.23.23")
t29: net.URL & "/foo/bar"
t30: net.URL & "%"
t31: net.URL & "https://foo.com/bar"
t32: net.AbsURL & "/foo/bar"
t33: net.AbsURL & "https://foo.com/bar"
t34: net.AbsURL & "%"
t35: net.AddIPOffset("127.0.0.1", 1)
t36: net.AddIPOffset("127.0.0.1/8", 2)
t37: net.AddIPOffset("2001:db8::", 1)
t38: net.AddIPOffset("2001:db8::/64", 2)
t39: net.AddIPOffset("::ffff:127.0.0.1", 1)
t40: net.AddIPCIDROffset("192.168.0.0/23", 1)
t41: net.AddIPCIDROffset("2001:db8:1111:2222::/64", 1)
-- out/net --
Errors:
t25: invalid value "2001:db8::1234567" (does not satisfy net.IPv6):
./in.cue:27:6
./in.cue:27:17
t30: invalid value "%" (does not satisfy net.URL): error in call to net.URL: parse "%": invalid URL escape "%":
./in.cue:32:6
./in.cue:32:16
t32: invalid value "/foo/bar" (does not satisfy net.AbsURL): error in call to net.AbsURL: URL is not absolute:
./in.cue:34:6
./in.cue:34:19
t34: invalid value "%" (does not satisfy net.AbsURL): error in call to net.AbsURL: parse "%": invalid URL escape "%":
./in.cue:36:6
./in.cue:36:19
t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4):
./in.cue:11:6
./in.cue:11:17
t7: error in call to net.JoinHostPort: invalid host [192, 30, 4]:
./in.cue:9:6
t13: invalid value "ff02::1:3" (does not satisfy net.IPv4):
./in.cue:15:6
./in.cue:15:19
t20: error in call to net.IPCIDR: netip.ParsePrefix("172.16.12.3"): no '/':
./in.cue:22:6
t27: invalid value "23.23.23.23" (does not satisfy net.IPv6):
./in.cue:29:6
./in.cue:29:19
Result:
t1: "foo.bar."
t2: false
t3: ["::%lo0", "80"]
t4: "mod.test:80"
t5: "[2001:db8::1]:80"
t6: "192.30.4.2:80"
t7: _|_ // t7: error in call to net.JoinHostPort: invalid host [192, 30, 4]
t8: true
t9: _|_ // t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4)
t10: true
t11: true
t12: false
t13: _|_ // t13: invalid value "ff02::1:3" (does not satisfy net.IPv4)
t14: true
t15: true
t16: [127, 0, 0, 1]
t17: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1]
t18: true
t19: true
t20: _|_ // t20: error in call to net.IPCIDR: netip.ParsePrefix("172.16.12.3"): no '/'
t21: "foo%2Fbar"
t22: "foo/bar"
t23: "f%25o"
t24: "f%o"
t25: _|_ // t25: invalid value "2001:db8::1234567" (does not satisfy net.IPv6)
t26: true
t27: _|_ // t27: invalid value "23.23.23.23" (does not satisfy net.IPv6)
t28: true
t29: "/foo/bar"
t30: _|_ // t30: invalid value "%" (does not satisfy net.URL): t30: error in call to net.URL: parse "%": invalid URL escape "%"
t31: "https://foo.com/bar"
t32: _|_ // t32: invalid value "/foo/bar" (does not satisfy net.AbsURL): t32: error in call to net.AbsURL: URL is not absolute
t33: "https://foo.com/bar"
t34: _|_ // t34: invalid value "%" (does not satisfy net.AbsURL): t34: error in call to net.AbsURL: parse "%": invalid URL escape "%"
t35: "127.0.0.2"
t36: "127.0.0.3/8"
t37: "2001:db8::1"
t38: "2001:db8::2/64"
t39: "::ffff:127.0.0.2"
t40: "192.168.2.0/23"
t41: "2001:db8:1111:2223::/64"