PAC: fix isPlainHostName()
Fix isPlainHostName() implementation and add test-case for it. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
This commit is contained in:
parent
1708b38d7b
commit
13213724b0
@ -78,7 +78,7 @@ function isInNet(ipaddr, pattern, maskstr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isPlainHostName(host) {
|
function isPlainHostName(host) {
|
||||||
return (host.search('\\\\.') == -1);
|
return (host.search('\\.') == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function isResolvable(host) {
|
function isResolvable(host) {
|
||||||
|
@ -109,6 +109,15 @@ def test_myIpAddress():
|
|||||||
_pac_equality_test("isResolvable(myIpAddress())", "true")
|
_pac_equality_test("isResolvable(myIpAddress())", "true")
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("host, expected", [
|
||||||
|
("example", "true"),
|
||||||
|
("example.com", "false"),
|
||||||
|
("www.example.com", "false"),
|
||||||
|
])
|
||||||
|
def test_isPlainHostName(host, expected):
|
||||||
|
_pac_equality_test("isPlainHostName('{}')".format(host), expected)
|
||||||
|
|
||||||
|
|
||||||
def test_proxyBindings():
|
def test_proxyBindings():
|
||||||
_pac_equality_test("JSON.stringify(ProxyConfig.bindings)", "'{}'")
|
_pac_equality_test("JSON.stringify(ProxyConfig.bindings)", "'{}'")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user