1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

vlib/net: add buffered IO, x.net -> net (#6754)

This commit is contained in:
Emily Hudson
2020-11-15 20:54:47 +00:00
committed by GitHub
parent 20bec81678
commit cd2a2cef25
55 changed files with 741 additions and 1648 deletions

View File

@@ -3,15 +3,17 @@ import net.ftp
// NB: this function makes network calls to external servers,
// 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`
fn test_ftp_client() {
fn ftp_client_test_inside() ? {
$if !network ? { return }
mut ftp := ftp.new()
defer {
ftp.close()
}
assert ftp.connect('ftp.redhat.com')
assert ftp.login('ftp', 'ftp')
pwd := ftp.pwd()
connect_result := ftp.connect('ftp.redhat.com')?
assert connect_result
login_result := ftp.login('ftp', 'ftp')?
assert login_result
pwd := ftp.pwd()?
assert pwd.len > 0
ftp.cd('/')
dir_list1 := ftp.dir() or {
@@ -31,3 +33,10 @@ fn test_ftp_client() {
}
assert blob.len > 0
}
fn test_ftp_cleint() {
ftp_client_test_inside() or {
panic(err)
}
}