cuelang.org/go@v0.13.0/pkg/net/testdata/gen.txtar (about) 1 # generated from the original tests. 2 # Henceforth it may be nicer to group tests into separate files. 3 -- in.cue -- 4 import "net" 5 6 t1: net.FQDN & "foo.bar." 7 t2: net.FQDN("foo.bararararararararararararararararararararararararararararararararara") 8 t3: net.SplitHostPort("[::%lo0]:80") 9 t4: net.JoinHostPort("mod.test", "80") 10 t5: net.JoinHostPort("2001:db8::1", 80) 11 t6: net.JoinHostPort([192, 30, 4, 2], 80) 12 t7: net.JoinHostPort([192, 30, 4], 80) 13 t8: net.IP("23.23.23.23") 14 t9: net.IPv4 & "23.23.23.2333" 15 t10: net.IP("23.23.23.23") 16 t11: net.IP("2001:db8::1") 17 t12: net.IPv4("2001:db8::1") 18 t13: net.IPv4() & "ff02::1:3" 19 t14: net.LoopbackIP([127, 0, 0, 1]) 20 t15: net.LoopbackIP("127.0.0.1") 21 t16: net.ToIP4("127.0.0.1") 22 t17: net.ToIP16("127.0.0.1") 23 t18: net.IPCIDR("192.168.1.0/24") 24 t19: net.IPCIDR("2001:db8:a0b:12f0::1/32") 25 t20: net.IPCIDR("172.16.12.3") 26 t21: net.PathEscape("foo/bar") 27 t22: net.PathUnescape("foo%2Fbar") 28 t23: net.QueryEscape("f%o") 29 t24: net.QueryUnescape("f%25o") 30 t25: net.IPv6 & "2001:db8::1234567" 31 t26: net.IPv6("2001:db8::1") 32 t27: net.IPv6() & "23.23.23.23" 33 t28: net.IP("0:0:0:0:0:0:23.23.23.23") 34 t29: net.URL & "/foo/bar" 35 t30: net.URL & "%" 36 t31: net.URL & "https://foo.com/bar" 37 t32: net.AbsURL & "/foo/bar" 38 t33: net.AbsURL & "https://foo.com/bar" 39 t34: net.AbsURL & "%" 40 -- out/net -- 41 Errors: 42 t25: invalid value "2001:db8::1234567" (does not satisfy net.IPv6): 43 ./in.cue:27:6 44 ./in.cue:27:17 45 t30: invalid value "%" (does not satisfy net.URL): error in call to net.URL: parse "%": invalid URL escape "%": 46 ./in.cue:32:6 47 ./in.cue:32:16 48 t32: invalid value "/foo/bar" (does not satisfy net.AbsURL): error in call to net.AbsURL: URL is not absolute: 49 ./in.cue:34:6 50 ./in.cue:34:19 51 t34: invalid value "%" (does not satisfy net.AbsURL): error in call to net.AbsURL: parse "%": invalid URL escape "%": 52 ./in.cue:36:6 53 ./in.cue:36:19 54 t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4): 55 ./in.cue:11:6 56 ./in.cue:11:17 57 t7: error in call to net.JoinHostPort: invalid host [192, 30, 4]: 58 ./in.cue:9:6 59 t13: invalid value "ff02::1:3" (does not satisfy net.IPv4): 60 ./in.cue:15:6 61 ./in.cue:15:19 62 t20: error in call to net.IPCIDR: netip.ParsePrefix("172.16.12.3"): no '/': 63 ./in.cue:22:6 64 t27: invalid value "23.23.23.23" (does not satisfy net.IPv6): 65 ./in.cue:29:6 66 ./in.cue:29:19 67 68 Result: 69 t1: "foo.bar." 70 t2: false 71 t3: ["::%lo0", "80"] 72 t4: "mod.test:80" 73 t5: "[2001:db8::1]:80" 74 t6: "192.30.4.2:80" 75 t7: _|_ // t7: error in call to net.JoinHostPort: invalid host [192, 30, 4] 76 t8: true 77 t9: _|_ // t9: invalid value "23.23.23.2333" (does not satisfy net.IPv4) 78 t10: true 79 t11: true 80 t12: false 81 t13: _|_ // t13: invalid value "ff02::1:3" (does not satisfy net.IPv4) 82 t14: true 83 t15: true 84 t16: [127, 0, 0, 1] 85 t17: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 255, 127, 0, 0, 1] 86 t18: true 87 t19: true 88 t20: _|_ // t20: error in call to net.IPCIDR: netip.ParsePrefix("172.16.12.3"): no '/' 89 t21: "foo%2Fbar" 90 t22: "foo/bar" 91 t23: "f%25o" 92 t24: "f%o" 93 t25: _|_ // t25: invalid value "2001:db8::1234567" (does not satisfy net.IPv6) 94 t26: true 95 t27: _|_ // t27: invalid value "23.23.23.23" (does not satisfy net.IPv6) 96 t28: true 97 t29: "/foo/bar" 98 t30: _|_ // t30: invalid value "%" (does not satisfy net.URL): t30: error in call to net.URL: parse "%": invalid URL escape "%" 99 t31: "https://foo.com/bar" 100 t32: _|_ // t32: invalid value "/foo/bar" (does not satisfy net.AbsURL): t32: error in call to net.AbsURL: URL is not absolute 101 t33: "https://foo.com/bar" 102 t34: _|_ // t34: invalid value "%" (does not satisfy net.AbsURL): t34: error in call to net.AbsURL: parse "%": invalid URL escape "%"