mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
enable $if !network {
checks in net tests
This commit is contained in:
parent
e1132156f5
commit
cc606623bb
@ -6,7 +6,7 @@ import net.ftp
|
|||||||
// that is why it is not a very good idea to run it in CI.
|
// that is why it is not a very good idea to run it in CI.
|
||||||
// If you want to run it manually, use `v -d network vlib/net/ftp/ftp_test.v`
|
// If you want to run it manually, use `v -d network vlib/net/ftp/ftp_test.v`
|
||||||
fn test_ftp_client() {
|
fn test_ftp_client() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
mut ftp := ftp.new()
|
mut ftp := ftp.new()
|
||||||
defer {
|
defer {
|
||||||
ftp.close()
|
ftp.close()
|
||||||
|
@ -36,7 +36,7 @@ fn http_fetch_mock(_methods []string, _config FetchConfig) ?[]Response {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_http_fetch_bare() {
|
fn test_http_fetch_bare() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
responses := http_fetch_mock([], FetchConfig{}) or {
|
responses := http_fetch_mock([], FetchConfig{}) or {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ fn test_http_fetch_bare() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_http_fetch_with_data() {
|
fn test_http_fetch_with_data() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
responses := http_fetch_mock(['POST', 'PUT', 'PATCH', 'DELETE'], {
|
responses := http_fetch_mock(['POST', 'PUT', 'PATCH', 'DELETE'], {
|
||||||
data: 'hello world'
|
data: 'hello world'
|
||||||
}) or {
|
}) or {
|
||||||
@ -61,7 +61,7 @@ fn test_http_fetch_with_data() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_http_fetch_with_params() {
|
fn test_http_fetch_with_params() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
responses := http_fetch_mock([], {
|
responses := http_fetch_mock([], {
|
||||||
params: {
|
params: {
|
||||||
'a': 'b',
|
'a': 'b',
|
||||||
@ -82,7 +82,7 @@ fn test_http_fetch_with_params() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_http_fetch_with_headers() {
|
fn test_http_fetch_with_headers() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
responses := http_fetch_mock([], {
|
responses := http_fetch_mock([], {
|
||||||
headers: {
|
headers: {
|
||||||
'Test-Header': 'hello world'
|
'Test-Header': 'hello world'
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import net.http
|
import net.http
|
||||||
|
|
||||||
fn test_http_get() {
|
fn test_http_get() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
assert http.get_text('https://vlang.io/version') == '0.1.5'
|
assert http.get_text('https://vlang.io/version') == '0.1.5'
|
||||||
println('http ok')
|
println('http ok')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_http_get_from_vlang_utc_now() {
|
fn test_http_get_from_vlang_utc_now() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
urls := ['http://vlang.io/utc_now', 'https://vlang.io/utc_now']
|
urls := ['http://vlang.io/utc_now', 'https://vlang.io/utc_now']
|
||||||
for url in urls {
|
for url in urls {
|
||||||
println('Test getting current time from $url by http.get')
|
println('Test getting current time from $url by http.get')
|
||||||
@ -20,7 +20,7 @@ fn test_http_get_from_vlang_utc_now() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_public_servers() {
|
fn test_public_servers() {
|
||||||
// $if !network ? { return }
|
$if !network ? { return }
|
||||||
urls := [
|
urls := [
|
||||||
'http://github.com/robots.txt',
|
'http://github.com/robots.txt',
|
||||||
'http://google.com/robots.txt',
|
'http://google.com/robots.txt',
|
||||||
|
Loading…
Reference in New Issue
Block a user