设为首页 加入收藏

TOP

golang单元测试一(简单函数测试)(六)
2023-07-23 13:29:47 】 浏览:128
Tags:golang 单元测 简单函
t: 1000, vhost: defaultURI.Vhost, canon: "amqp://192.168.1.1:1000/", }, { url: "amqp://[::1]", username: defaultURI.Username, password: defaultURI.Password, host: "::1", port: defaultURI.Port, vhost: defaultURI.Vhost, canon: "amqp://[::1]/", }, { url: "amqp://[::1]:1000", username: defaultURI.Username, password: defaultURI.Password, host: "::1", port: 1000, vhost: defaultURI.Vhost, canon: "amqp://[::1]:1000/", }, { url: "amqp://[fe80::1]", username: defaultURI.Username, password: defaultURI.Password, host: "fe80::1", port: defaultURI.Port, vhost: defaultURI.Vhost, canon: "amqp://[fe80::1]/", }, { url: "amqp://[fe80::1]", username: defaultURI.Username, password: defaultURI.Password, host: "fe80::1", port: defaultURI.Port, vhost: defaultURI.Vhost, canon: "amqp://[fe80::1]/", }, { url: "amqp://[fe80::1%25en0]", username: defaultURI.Username, password: defaultURI.Password, host: "fe80::1%en0", port: defaultURI.Port, vhost: defaultURI.Vhost, canon: "amqp://[fe80::1%25en0]/", }, { url: "amqp://[fe80::1]:5671", username: defaultURI.Username, password: defaultURI.Password, host: "fe80::1", port: 5671, vhost: defaultURI.Vhost, canon: "amqp://[fe80::1]:5671/", }, { url: "amqps:///", username: defaultURI.Username, password: defaultURI.Password, host: defaultURI.Host, port: schemePorts["amqps"], vhost: defaultURI.Vhost, canon: "amqps://localhost/", }, { url: "amqps://host:1000/", username: defaultURI.Username, password: defaultURI.Password, host: "host", port: 1000, vhost: defaultURI.Vhost, canon: "amqps://host:1000/", }, } func TestURISpec(t *testing.T) { for _, test := range uriTests { u, err := ParseURI(test.url) if err != nil { t.Fatal("Could not parse spec URI: ", test.url, " err: ", err) } if test.username != u.Username { t.Error("For: ", test.url, " usernames do not match. want: ", test.username, " got: ", u.Username) } if test.password != u.Password { t.Error("For: ", test.url, " passwords do not match. want: ", test.password, " got: ", u.Password) } if test.host != u.Host { t.Error("For: ", test.url, " hosts do not match. want: ", test.host, " got: ", u.Host) } if test.port != u.Port { t.Error("For: ", test.url, " ports do not match. want: ", test.port, " got: ", u.Port) } if test.vhost != u.Vhost { t.Error("For: ", test.url, " vhosts do not match. want: ", test.vhost, " got: ", u.Vhost) } if test.canon != u.String() { t.Error("For: ", test.url, " canonical string does not match. want: ", test.canon, " got: ", u.String()) } } } func TestURIUnknownScheme(t *testing.T) { if _, err := ParseURI("http://ex
首页 上一页 3 4 5 6 7 8 下一页 尾页 6/8/8
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇golang中的init初始化函数 下一篇golang的内存管理

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目