mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: extract slow tests (prod, valgrind, inout, repl etc), from vlib/v/tests/ to vlib/v/slow_tests/ (#16892)
This commit is contained in:
parent
33a99fe833
commit
6a32c81070
6
TESTS.md
6
TESTS.md
@ -51,7 +51,7 @@ This folder contains _test.v files, testing the different features of the V
|
|||||||
compiler. Each of them will be compiled, and all the features in them have
|
compiler. Each of them will be compiled, and all the features in them have
|
||||||
to work (verified by assertions).
|
to work (verified by assertions).
|
||||||
|
|
||||||
## `v vlib/v/tests/inout/compiler_test.v`
|
## `v vlib/v/slow_tests/inout/compiler_test.v`
|
||||||
|
|
||||||
This is a *test runner*, that checks whether the output of running a V program,
|
This is a *test runner*, that checks whether the output of running a V program,
|
||||||
matches an expected .out file. You can also check for code that does panic
|
matches an expected .out file. You can also check for code that does panic
|
||||||
@ -59,7 +59,7 @@ using this test runner - just paste the start of the `panic()` output in the
|
|||||||
corresponding .out file.
|
corresponding .out file.
|
||||||
|
|
||||||
NB: these tests, expect to find a pair of `.vv` and `.out` files, in the folder:
|
NB: these tests, expect to find a pair of `.vv` and `.out` files, in the folder:
|
||||||
vlib/v/tests/inout
|
vlib/v/slow_tests/inout
|
||||||
|
|
||||||
The test runner will run each `.vv` file, and will check that its output, matches
|
The test runner will run each `.vv` file, and will check that its output, matches
|
||||||
the contents of the `.out` file with the same base name. This is particularly useful
|
the contents of the `.out` file with the same base name. This is particularly useful
|
||||||
@ -77,7 +77,7 @@ Each `.c.must_have` file, consists of multiple lines. Each of these
|
|||||||
lines, *should* be present *at least once* in the output, when the .vv
|
lines, *should* be present *at least once* in the output, when the .vv
|
||||||
file is compiled with `-o -` .
|
file is compiled with `-o -` .
|
||||||
|
|
||||||
## `v vlib/v/tests/run_project_folders_test.v`
|
## `v vlib/v/slow_tests/run_project_folders_test.v`
|
||||||
This *test runner*, checks whether whole project folders, can be compiled, and run.
|
This *test runner*, checks whether whole project folders, can be compiled, and run.
|
||||||
|
|
||||||
NB: Each project in these folders, should finish with an exit code of 0,
|
NB: Each project in these folders, should finish with an exit code of 0,
|
||||||
|
@ -15,10 +15,10 @@ const vet_known_failing_windows = [
|
|||||||
'vlib/v/gen/js/tests/testdata/compare_ints.v',
|
'vlib/v/gen/js/tests/testdata/compare_ints.v',
|
||||||
'vlib/v/gen/js/tests/testdata/hw.v',
|
'vlib/v/gen/js/tests/testdata/hw.v',
|
||||||
'vlib/v/gen/js/tests/testdata/string_methods.v',
|
'vlib/v/gen/js/tests/testdata/string_methods.v',
|
||||||
'vlib/v/tests/inout/vscript_using_generics_in_os.vsh',
|
'vlib/v/slow_tests/inout/vscript_using_generics_in_os.vsh',
|
||||||
'vlib/v/tests/project_with_modules_having_submodules/bin/main.vsh',
|
'vlib/v/tests/project_with_modules_having_submodules/bin/main.vsh',
|
||||||
'vlib/v/tests/valgrind/simple_interpolation_script_mode.v',
|
'vlib/v/slow_tests/valgrind/simple_interpolation_script_mode.v',
|
||||||
'vlib/v/tests/valgrind/simple_interpolation_script_mode_more_scopes.v',
|
'vlib/v/slow_tests/valgrind/simple_interpolation_script_mode_more_scopes.v',
|
||||||
]
|
]
|
||||||
|
|
||||||
const vet_folders = [
|
const vet_folders = [
|
||||||
|
@ -80,7 +80,7 @@ const (
|
|||||||
'vlib/v/gen/native/macho_test.v',
|
'vlib/v/gen/native/macho_test.v',
|
||||||
'vlib/v/gen/native/tests/native_test.v',
|
'vlib/v/gen/native/tests/native_test.v',
|
||||||
'vlib/v/pkgconfig/pkgconfig_test.v',
|
'vlib/v/pkgconfig/pkgconfig_test.v',
|
||||||
'vlib/v/tests/inout/compiler_test.v',
|
'vlib/v/slow_tests/inout/compiler_test.v',
|
||||||
'vlib/x/json2/json2_test.v',
|
'vlib/x/json2/json2_test.v',
|
||||||
]
|
]
|
||||||
skip_test_files = [
|
skip_test_files = [
|
||||||
@ -102,11 +102,11 @@ const (
|
|||||||
'vlib/v/live/live_test.v',
|
'vlib/v/live/live_test.v',
|
||||||
'vlib/v/parser/v_parser_test.v',
|
'vlib/v/parser/v_parser_test.v',
|
||||||
'vlib/v/scanner/scanner_test.v',
|
'vlib/v/scanner/scanner_test.v',
|
||||||
'vlib/v/tests/inout/compiler_test.v',
|
'vlib/v/slow_tests/inout/compiler_test.v',
|
||||||
'vlib/v/tests/prod_test.v',
|
'vlib/v/slow_tests/prod_test.v',
|
||||||
'vlib/v/tests/profile/profile_test.v',
|
'vlib/v/slow_tests/profile/profile_test.v',
|
||||||
'vlib/v/tests/repl/repl_test.v',
|
'vlib/v/slow_tests/repl/repl_test.v',
|
||||||
'vlib/v/tests/valgrind/valgrind_test.v',
|
'vlib/v/slow_tests/valgrind/valgrind_test.v',
|
||||||
]
|
]
|
||||||
skip_with_fsanitize_memory = [
|
skip_with_fsanitize_memory = [
|
||||||
'vlib/net/tcp_simple_client_server_test.v',
|
'vlib/net/tcp_simple_client_server_test.v',
|
||||||
@ -159,7 +159,7 @@ const (
|
|||||||
'do_not_remove',
|
'do_not_remove',
|
||||||
]
|
]
|
||||||
skip_on_musl = [
|
skip_on_musl = [
|
||||||
'vlib/v/tests/profile/profile_test.v',
|
'vlib/v/slow_tests/profile/profile_test.v',
|
||||||
'vlib/gg/draw_fns_api_test.v',
|
'vlib/gg/draw_fns_api_test.v',
|
||||||
'vlib/v/tests/skip_unused/gg_code.vv',
|
'vlib/v/tests/skip_unused/gg_code.vv',
|
||||||
]
|
]
|
||||||
|
@ -87,7 +87,7 @@ fn main() {
|
|||||||
|
|
||||||
// vet_file vets the file read from `path`.
|
// vet_file vets the file read from `path`.
|
||||||
fn (mut vt Vet) vet_file(path string) {
|
fn (mut vt Vet) vet_file(path string) {
|
||||||
if path.contains('/tests/') && !vt.opt.is_force {
|
if !vt.opt.is_force && (path.contains('/tests/') || path.contains('/slow_tests/')) {
|
||||||
// skip all /tests/ files, since usually their content is not
|
// skip all /tests/ files, since usually their content is not
|
||||||
// important enough to be documented/vetted, and they may even
|
// important enough to be documented/vetted, and they may even
|
||||||
// contain intentionally invalid code.
|
// contain intentionally invalid code.
|
||||||
|
@ -3,6 +3,7 @@ builtin/linux_bare
|
|||||||
builtin/wasm_bare
|
builtin/wasm_bare
|
||||||
os/bare
|
os/bare
|
||||||
v/tests/
|
v/tests/
|
||||||
|
v/slow_tests/
|
||||||
v/checker/tests/
|
v/checker/tests/
|
||||||
v/gen/js/tests/
|
v/gen/js/tests/
|
||||||
v/gen/native/tests/
|
v/gen/native/tests/
|
||||||
|
@ -14,7 +14,8 @@ const (
|
|||||||
addr_ip_any = [4]u8{init: u8(0)}
|
addr_ip_any = [4]u8{init: u8(0)}
|
||||||
)
|
)
|
||||||
|
|
||||||
fn new_ip6(port u16, addr [16]u8) Addr {
|
// new_ip6 creates a new Addr from the IP6 address family, based on the given port and addr
|
||||||
|
pub fn new_ip6(port u16, addr [16]u8) Addr {
|
||||||
a := Addr{
|
a := Addr{
|
||||||
f: u8(AddrFamily.ip6)
|
f: u8(AddrFamily.ip6)
|
||||||
addr: AddrData{
|
addr: AddrData{
|
||||||
@ -29,7 +30,8 @@ fn new_ip6(port u16, addr [16]u8) Addr {
|
|||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
fn new_ip(port u16, addr [4]u8) Addr {
|
// new_ip creates a new Addr from the IPv4 address family, based on the given port and addr
|
||||||
|
pub fn new_ip(port u16, addr [4]u8) Addr {
|
||||||
a := Addr{
|
a := Addr{
|
||||||
f: u8(AddrFamily.ip)
|
f: u8(AddrFamily.ip)
|
||||||
addr: AddrData{
|
addr: AddrData{
|
||||||
@ -56,6 +58,7 @@ fn temp_unix() !Addr {
|
|||||||
return addrs[0]
|
return addrs[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// family returns the family/kind of the given address `a`
|
||||||
pub fn (a Addr) family() AddrFamily {
|
pub fn (a Addr) family() AddrFamily {
|
||||||
return unsafe { AddrFamily(a.f) }
|
return unsafe { AddrFamily(a.f) }
|
||||||
}
|
}
|
||||||
@ -65,7 +68,8 @@ const (
|
|||||||
max_ip6_len = 46
|
max_ip6_len = 46
|
||||||
)
|
)
|
||||||
|
|
||||||
fn (a Ip) str() string {
|
// str returns a string representation of `a`
|
||||||
|
pub fn (a Ip) str() string {
|
||||||
buf := [net.max_ip_len]char{}
|
buf := [net.max_ip_len]char{}
|
||||||
|
|
||||||
res := &char(C.inet_ntop(.ip, &a.addr, &buf[0], buf.len))
|
res := &char(C.inet_ntop(.ip, &a.addr, &buf[0], buf.len))
|
||||||
@ -80,7 +84,8 @@ fn (a Ip) str() string {
|
|||||||
return '${saddr}:${port}'
|
return '${saddr}:${port}'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (a Ip6) str() string {
|
// str returns a string representation of `a`
|
||||||
|
pub fn (a Ip6) str() string {
|
||||||
buf := [net.max_ip6_len]char{}
|
buf := [net.max_ip6_len]char{}
|
||||||
|
|
||||||
res := &char(C.inet_ntop(.ip6, &a.addr, &buf[0], buf.len))
|
res := &char(C.inet_ntop(.ip6, &a.addr, &buf[0], buf.len))
|
||||||
@ -97,7 +102,8 @@ fn (a Ip6) str() string {
|
|||||||
|
|
||||||
const aoffset = __offsetof(Addr, addr)
|
const aoffset = __offsetof(Addr, addr)
|
||||||
|
|
||||||
fn (a Addr) len() u32 {
|
// len returns the length in bytes of the address `a`, depending on its family
|
||||||
|
pub fn (a Addr) len() u32 {
|
||||||
match a.family() {
|
match a.family() {
|
||||||
.ip {
|
.ip {
|
||||||
return sizeof(Ip) + net.aoffset
|
return sizeof(Ip) + net.aoffset
|
||||||
@ -114,6 +120,7 @@ fn (a Addr) len() u32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resolve_addrs converts the given `addr`, `family` and `@type` to a list of addresses
|
||||||
pub fn resolve_addrs(addr string, family AddrFamily, @type SocketType) ![]Addr {
|
pub fn resolve_addrs(addr string, family AddrFamily, @type SocketType) ![]Addr {
|
||||||
match family {
|
match family {
|
||||||
.ip, .ip6, .unspec {
|
.ip, .ip6, .unspec {
|
||||||
@ -143,6 +150,7 @@ pub fn resolve_addrs(addr string, family AddrFamily, @type SocketType) ![]Addr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resolve_addrs converts the given `addr` and `@type` to a list of addresses
|
||||||
pub fn resolve_addrs_fuzzy(addr string, @type SocketType) ![]Addr {
|
pub fn resolve_addrs_fuzzy(addr string, @type SocketType) ![]Addr {
|
||||||
if addr.len == 0 {
|
if addr.len == 0 {
|
||||||
return error('none')
|
return error('none')
|
||||||
@ -160,6 +168,7 @@ pub fn resolve_addrs_fuzzy(addr string, @type SocketType) ![]Addr {
|
|||||||
return resolve_addrs(addr, .unix, @type)
|
return resolve_addrs(addr, .unix, @type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// resolve_ipaddrs converts the given `addr`, `family` and `typ` to a list of addresses
|
||||||
pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ![]Addr {
|
pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ![]Addr {
|
||||||
address, port := split_address(addr)!
|
address, port := split_address(addr)!
|
||||||
|
|
||||||
@ -238,7 +247,8 @@ pub fn resolve_ipaddrs(addr string, family AddrFamily, typ SocketType) ![]Addr {
|
|||||||
return addresses
|
return addresses
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (a Addr) str() string {
|
// str returns a string representation of the address `a`
|
||||||
|
pub fn (a Addr) str() string {
|
||||||
match unsafe { AddrFamily(a.f) } {
|
match unsafe { AddrFamily(a.f) } {
|
||||||
.ip {
|
.ip {
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -261,6 +271,7 @@ fn (a Addr) str() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// addr_from_socket_handle returns an address, based on the given integer socket `handle`
|
||||||
pub fn addr_from_socket_handle(handle int) Addr {
|
pub fn addr_from_socket_handle(handle int) Addr {
|
||||||
addr := Addr{
|
addr := Addr{
|
||||||
addr: AddrData{
|
addr: AddrData{
|
||||||
|
@ -29,7 +29,7 @@ fn test_header_adds_multiple() {
|
|||||||
|
|
||||||
fn test_header_get() {
|
fn test_header_get() {
|
||||||
mut h := new_header(key: .dnt, value: 'one')
|
mut h := new_header(key: .dnt, value: 'one')
|
||||||
h.add_custom('dnt', 'two')?
|
h.add_custom('dnt', 'two')!
|
||||||
dnt := h.get_custom('dnt') or { '' }
|
dnt := h.get_custom('dnt') or { '' }
|
||||||
exact := h.get_custom('dnt', exact: true) or { '' }
|
exact := h.get_custom('dnt', exact: true) or { '' }
|
||||||
assert dnt == 'one'
|
assert dnt == 'one'
|
||||||
@ -42,7 +42,7 @@ fn test_header_set() {
|
|||||||
value: 'two'
|
value: 'two'
|
||||||
)
|
)
|
||||||
assert h.values(.dnt) == ['one', 'two']
|
assert h.values(.dnt) == ['one', 'two']
|
||||||
h.set_custom('DNT', 'three')?
|
h.set_custom('DNT', 'three')!
|
||||||
assert h.values(.dnt) == ['three']
|
assert h.values(.dnt) == ['three']
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,8 +67,8 @@ fn test_header_delete_not_existing() {
|
|||||||
|
|
||||||
fn test_custom_header() {
|
fn test_custom_header() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('AbC', 'dEf')?
|
h.add_custom('AbC', 'dEf')!
|
||||||
h.add_custom('aBc', 'GhI')?
|
h.add_custom('aBc', 'GhI')!
|
||||||
assert h.custom_values('AbC', exact: true) == ['dEf']
|
assert h.custom_values('AbC', exact: true) == ['dEf']
|
||||||
assert h.custom_values('aBc', exact: true) == ['GhI']
|
assert h.custom_values('aBc', exact: true) == ['GhI']
|
||||||
assert h.custom_values('ABC') == ['dEf', 'GhI']
|
assert h.custom_values('ABC') == ['dEf', 'GhI']
|
||||||
@ -77,13 +77,13 @@ fn test_custom_header() {
|
|||||||
h.delete_custom('AbC')
|
h.delete_custom('AbC')
|
||||||
h.delete_custom('aBc')
|
h.delete_custom('aBc')
|
||||||
|
|
||||||
h.add_custom('abc', 'def')?
|
h.add_custom('abc', 'def')!
|
||||||
assert h.custom_values('abc') == ['def']
|
assert h.custom_values('abc') == ['def']
|
||||||
assert h.custom_values('ABC') == ['def']
|
assert h.custom_values('ABC') == ['def']
|
||||||
assert h.keys() == ['abc']
|
assert h.keys() == ['abc']
|
||||||
h.delete_custom('abc')
|
h.delete_custom('abc')
|
||||||
|
|
||||||
h.add_custom('accEPT', '*/*')?
|
h.add_custom('accEPT', '*/*')!
|
||||||
assert h.custom_values('ACCept') == ['*/*']
|
assert h.custom_values('ACCept') == ['*/*']
|
||||||
assert h.values(.accept) == ['*/*']
|
assert h.values(.accept) == ['*/*']
|
||||||
assert h.keys() == ['accEPT']
|
assert h.keys() == ['accEPT']
|
||||||
@ -91,7 +91,7 @@ fn test_custom_header() {
|
|||||||
|
|
||||||
fn test_contains_custom() {
|
fn test_contains_custom() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('Hello', 'world')?
|
h.add_custom('Hello', 'world')!
|
||||||
assert h.contains_custom('hello')
|
assert h.contains_custom('hello')
|
||||||
assert h.contains_custom('HELLO')
|
assert h.contains_custom('HELLO')
|
||||||
assert h.contains_custom('Hello', exact: true)
|
assert h.contains_custom('Hello', exact: true)
|
||||||
@ -101,7 +101,7 @@ fn test_contains_custom() {
|
|||||||
|
|
||||||
fn test_get_custom() {
|
fn test_get_custom() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('Hello', 'world')?
|
h.add_custom('Hello', 'world')!
|
||||||
assert h.get_custom('hello')? == 'world'
|
assert h.get_custom('hello')? == 'world'
|
||||||
assert h.get_custom('HELLO')? == 'world'
|
assert h.get_custom('HELLO')? == 'world'
|
||||||
assert h.get_custom('Hello', exact: true)? == 'world'
|
assert h.get_custom('Hello', exact: true)? == 'world'
|
||||||
@ -117,15 +117,15 @@ fn test_get_custom() {
|
|||||||
|
|
||||||
fn test_starting_with() {
|
fn test_starting_with() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('Hello-1', 'world')?
|
h.add_custom('Hello-1', 'world')!
|
||||||
h.add_custom('Hello-21', 'world')?
|
h.add_custom('Hello-21', 'world')!
|
||||||
assert h.starting_with('Hello-')? == 'Hello-1'
|
assert h.starting_with('Hello-')? == 'Hello-1'
|
||||||
assert h.starting_with('Hello-2')? == 'Hello-21'
|
assert h.starting_with('Hello-2')? == 'Hello-21'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_custom_values() {
|
fn test_custom_values() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('Hello', 'world')?
|
h.add_custom('Hello', 'world')!
|
||||||
assert h.custom_values('hello') == ['world']
|
assert h.custom_values('hello') == ['world']
|
||||||
assert h.custom_values('HELLO') == ['world']
|
assert h.custom_values('HELLO') == ['world']
|
||||||
assert h.custom_values('Hello', exact: true) == ['world']
|
assert h.custom_values('Hello', exact: true) == ['world']
|
||||||
@ -135,7 +135,7 @@ fn test_custom_values() {
|
|||||||
|
|
||||||
fn test_coerce() {
|
fn test_coerce() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add(.accept, 'bar')
|
h.add(.accept, 'bar')
|
||||||
assert h.values(.accept) == ['foo', 'bar']
|
assert h.values(.accept) == ['foo', 'bar']
|
||||||
assert h.keys().len == 2
|
assert h.keys().len == 2
|
||||||
@ -147,7 +147,7 @@ fn test_coerce() {
|
|||||||
|
|
||||||
fn test_coerce_canonicalize() {
|
fn test_coerce_canonicalize() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add(.accept, 'bar')
|
h.add(.accept, 'bar')
|
||||||
assert h.values(.accept) == ['foo', 'bar']
|
assert h.values(.accept) == ['foo', 'bar']
|
||||||
assert h.keys().len == 2
|
assert h.keys().len == 2
|
||||||
@ -159,9 +159,9 @@ fn test_coerce_canonicalize() {
|
|||||||
|
|
||||||
fn test_coerce_custom() {
|
fn test_coerce_custom() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('Hello', 'foo')?
|
h.add_custom('Hello', 'foo')!
|
||||||
h.add_custom('hello', 'bar')?
|
h.add_custom('hello', 'bar')!
|
||||||
h.add_custom('HELLO', 'baz')?
|
h.add_custom('HELLO', 'baz')!
|
||||||
assert h.custom_values('hello') == ['foo', 'bar', 'baz']
|
assert h.custom_values('hello') == ['foo', 'bar', 'baz']
|
||||||
assert h.keys().len == 3
|
assert h.keys().len == 3
|
||||||
|
|
||||||
@ -172,8 +172,8 @@ fn test_coerce_custom() {
|
|||||||
|
|
||||||
fn test_coerce_canonicalize_custom() {
|
fn test_coerce_canonicalize_custom() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('foo-BAR', 'foo')?
|
h.add_custom('foo-BAR', 'foo')!
|
||||||
h.add_custom('FOO-bar', 'bar')?
|
h.add_custom('FOO-bar', 'bar')!
|
||||||
assert h.custom_values('foo-bar') == ['foo', 'bar']
|
assert h.custom_values('foo-bar') == ['foo', 'bar']
|
||||||
assert h.keys().len == 2
|
assert h.keys().len == 2
|
||||||
|
|
||||||
@ -184,8 +184,8 @@ fn test_coerce_canonicalize_custom() {
|
|||||||
|
|
||||||
fn test_render_version() {
|
fn test_render_version() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add_custom('Accept', 'bar')?
|
h.add_custom('Accept', 'bar')!
|
||||||
h.add(.accept, 'baz')
|
h.add(.accept, 'baz')
|
||||||
|
|
||||||
s1_0 := h.render(version: .v1_0)
|
s1_0 := h.render(version: .v1_0)
|
||||||
@ -206,8 +206,8 @@ fn test_render_version() {
|
|||||||
|
|
||||||
fn test_render_coerce() {
|
fn test_render_coerce() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add_custom('Accept', 'bar')?
|
h.add_custom('Accept', 'bar')!
|
||||||
h.add(.accept, 'baz')
|
h.add(.accept, 'baz')
|
||||||
h.add(.host, 'host')
|
h.add(.host, 'host')
|
||||||
|
|
||||||
@ -232,8 +232,8 @@ fn test_render_coerce() {
|
|||||||
|
|
||||||
fn test_render_canonicalize() {
|
fn test_render_canonicalize() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add_custom('Accept', 'bar')?
|
h.add_custom('Accept', 'bar')!
|
||||||
h.add(.accept, 'baz')
|
h.add(.accept, 'baz')
|
||||||
h.add(.host, 'host')
|
h.add(.host, 'host')
|
||||||
|
|
||||||
@ -258,8 +258,8 @@ fn test_render_canonicalize() {
|
|||||||
|
|
||||||
fn test_render_coerce_canonicalize() {
|
fn test_render_coerce_canonicalize() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add_custom('accept', 'foo')?
|
h.add_custom('accept', 'foo')!
|
||||||
h.add_custom('Accept', 'bar')?
|
h.add_custom('Accept', 'bar')!
|
||||||
h.add(.accept, 'baz')
|
h.add(.accept, 'baz')
|
||||||
h.add(.host, 'host')
|
h.add(.host, 'host')
|
||||||
|
|
||||||
@ -285,8 +285,8 @@ fn test_render_coerce_canonicalize() {
|
|||||||
fn test_str() {
|
fn test_str() {
|
||||||
mut h := new_header()
|
mut h := new_header()
|
||||||
h.add(.accept, 'text/html')
|
h.add(.accept, 'text/html')
|
||||||
h.add_custom('Accept', 'image/jpeg')?
|
h.add_custom('Accept', 'image/jpeg')!
|
||||||
h.add_custom('X-custom', 'Hello')?
|
h.add_custom('X-custom', 'Hello')!
|
||||||
|
|
||||||
// key order is not guaranteed
|
// key order is not guaranteed
|
||||||
assert h.str() == 'Accept: text/html\r\nAccept: image/jpeg\r\nX-custom: Hello\r\n'
|
assert h.str() == 'Accept: text/html\r\nAccept: image/jpeg\r\nX-custom: Hello\r\n'
|
||||||
@ -308,7 +308,7 @@ fn test_custom_header_from_map() {
|
|||||||
h := new_custom_header_from_map({
|
h := new_custom_header_from_map({
|
||||||
'Server': 'VWeb'
|
'Server': 'VWeb'
|
||||||
'foo': 'bar'
|
'foo': 'bar'
|
||||||
})?
|
})!
|
||||||
assert h.contains_custom('server')
|
assert h.contains_custom('server')
|
||||||
assert h.contains_custom('foo')
|
assert h.contains_custom('foo')
|
||||||
assert h.get_custom('server') or { '' } == 'VWeb'
|
assert h.get_custom('server') or { '' } == 'VWeb'
|
||||||
@ -323,7 +323,7 @@ fn test_header_join() {
|
|||||||
h2 := new_custom_header_from_map({
|
h2 := new_custom_header_from_map({
|
||||||
'Server': 'VWeb'
|
'Server': 'VWeb'
|
||||||
'foo': 'bar'
|
'foo': 'bar'
|
||||||
})?
|
})!
|
||||||
h3 := h1.join(h2)
|
h3 := h1.join(h2)
|
||||||
// h1 is unchanged
|
// h1 is unchanged
|
||||||
assert h1.contains(.accept)
|
assert h1.contains(.accept)
|
||||||
|
@ -30,17 +30,17 @@ fn one_shot_echo_server(mut l net.TcpListener, ch_started chan int) ? {
|
|||||||
new_conn.close() or {}
|
new_conn.close() or {}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn echo(address string) ? {
|
fn echo(address string) ! {
|
||||||
mut c := net.dial_tcp(address)?
|
mut c := net.dial_tcp(address)!
|
||||||
defer {
|
defer {
|
||||||
c.close() or {}
|
c.close() or {}
|
||||||
}
|
}
|
||||||
|
|
||||||
println('local: ' + c.addr()?.str())
|
println('local: ' + c.addr()!.str())
|
||||||
println(' peer: ' + c.peer_addr()?.str())
|
println(' peer: ' + c.peer_addr()!.str())
|
||||||
|
|
||||||
data := 'Hello from vlib/net!'
|
data := 'Hello from vlib/net!'
|
||||||
c.write_string(data)?
|
c.write_string(data)!
|
||||||
mut buf := []u8{len: 4096}
|
mut buf := []u8{len: 4096}
|
||||||
read := c.read(mut buf) or { panic(err) }
|
read := c.read(mut buf) or { panic(err) }
|
||||||
assert read == data.len
|
assert read == data.len
|
||||||
@ -105,6 +105,6 @@ fn test_bind() {
|
|||||||
$if !network ? {
|
$if !network ? {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
mut conn := net.dial_tcp_with_bind('vlang.io:80', '127.0.0.1:0')?
|
mut conn := net.dial_tcp_with_bind('vlang.io:80', '127.0.0.1:0')!
|
||||||
conn.close()?
|
conn.close()!
|
||||||
}
|
}
|
||||||
|
@ -36,8 +36,8 @@ fn test_escape_unescape() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_parse_query() {
|
fn test_parse_query() {
|
||||||
q1 := urllib.parse_query('format=%22%25l%3A+%25c+%25t%22')?
|
q1 := urllib.parse_query('format=%22%25l%3A+%25c+%25t%22')!
|
||||||
q2 := urllib.parse_query('format="%l:+%c+%t"')?
|
q2 := urllib.parse_query('format="%l:+%c+%t"')!
|
||||||
// dump(q1)
|
// dump(q1)
|
||||||
// dump(q2)
|
// dump(q2)
|
||||||
assert q1.get('format') == '"%l: %c %t"'
|
assert q1.get('format') == '"%l: %c %t"'
|
||||||
@ -45,21 +45,21 @@ fn test_parse_query() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn test_parse_query_orders() {
|
fn test_parse_query_orders() {
|
||||||
query_one := urllib.parse_query('https://someapi.com/endpoint?gamma=zalibaba&tau=1&alpha=alibaba&signature=alibaba123')?
|
query_one := urllib.parse_query('https://someapi.com/endpoint?gamma=zalibaba&tau=1&alpha=alibaba&signature=alibaba123')!
|
||||||
qvalues := query_one.values()
|
qvalues := query_one.values()
|
||||||
assert qvalues == ['zalibaba', '1', 'alibaba', 'alibaba123']
|
assert qvalues == ['zalibaba', '1', 'alibaba', 'alibaba123']
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_parse_missing_host() {
|
fn test_parse_missing_host() {
|
||||||
// issue #10311
|
// issue #10311
|
||||||
url := urllib.parse('http:///')?
|
url := urllib.parse('http:///')!
|
||||||
assert url.str() == 'http://///'
|
assert url.str() == 'http://///'
|
||||||
}
|
}
|
||||||
|
|
||||||
// testing the case where the key as a null value
|
// testing the case where the key as a null value
|
||||||
// e.g ?key=
|
// e.g ?key=
|
||||||
fn test_parse_none_value() {
|
fn test_parse_none_value() {
|
||||||
query_one := urllib.parse_query('gamma=zalibaba&tau=1&alpha=alibaba&signature=')?
|
query_one := urllib.parse_query('gamma=zalibaba&tau=1&alpha=alibaba&signature=')!
|
||||||
qvalues := query_one.values()
|
qvalues := query_one.values()
|
||||||
qvalues_map := query_one.to_map()
|
qvalues_map := query_one.to_map()
|
||||||
assert qvalues == ['zalibaba', '1', 'alibaba']
|
assert qvalues == ['zalibaba', '1', 'alibaba']
|
||||||
@ -75,7 +75,7 @@ fn test_parse_none_value() {
|
|||||||
// e.g https://www.vlang.dev?alibaba
|
// e.g https://www.vlang.dev?alibaba
|
||||||
fn test_parse_empty_query_one() {
|
fn test_parse_empty_query_one() {
|
||||||
query_str := 'alibaba'
|
query_str := 'alibaba'
|
||||||
query_one := urllib.parse_query(query_str)?
|
query_one := urllib.parse_query(query_str)!
|
||||||
qvalues := query_one.values()
|
qvalues := query_one.values()
|
||||||
qvalues_map := query_one.to_map()
|
qvalues_map := query_one.to_map()
|
||||||
query_encode := query_one.encode()
|
query_encode := query_one.encode()
|
||||||
@ -90,7 +90,7 @@ fn test_parse_empty_query_one() {
|
|||||||
// e.g https://www.vlang.dev?
|
// e.g https://www.vlang.dev?
|
||||||
fn test_parse_empty_query_two() {
|
fn test_parse_empty_query_two() {
|
||||||
query_str := ''
|
query_str := ''
|
||||||
query_one := urllib.parse_query(query_str)?
|
query_one := urllib.parse_query(query_str)!
|
||||||
qvalues := query_one.values()
|
qvalues := query_one.values()
|
||||||
qvalues_map := query_one.to_map()
|
qvalues_map := query_one.to_map()
|
||||||
query_encode := query_one.encode()
|
query_encode := query_one.encode()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import v.tests.assembly.util
|
import v.slow_tests.assembly.util
|
||||||
|
|
||||||
fn test_inline_asm() {
|
fn test_inline_asm() {
|
||||||
a, mut b := i64(10), i64(0)
|
a, mut b := i64(10), i64(0)
|
20
vlib/v/slow_tests/inout/bad_st_as.vv
Normal file
20
vlib/v/slow_tests/inout/bad_st_as.vv
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
struct Struct {
|
||||||
|
struct_name string
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Interface {
|
||||||
|
interface_name string
|
||||||
|
}
|
||||||
|
|
||||||
|
type Info = Interface | Struct
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
mut info := Info{}
|
||||||
|
info = Struct{
|
||||||
|
struct_name: 'Foo'
|
||||||
|
}
|
||||||
|
s := info as Struct
|
||||||
|
println(s.struct_name)
|
||||||
|
i := info as Interface // wrong
|
||||||
|
println(i.interface_name)
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
import cli {Command}
|
import cli { Command }
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut cmd := Command{
|
mut cmd := Command{
|
@ -1,8 +1,8 @@
|
|||||||
import cli {Command}
|
import cli { Command }
|
||||||
import os
|
import os
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
mut cmd := Command {}
|
mut cmd := Command{}
|
||||||
cmd.disable_man = true
|
cmd.disable_man = true
|
||||||
cmd.parse(os.args)
|
cmd.parse(os.args)
|
||||||
}
|
}
|
@ -15,9 +15,9 @@ fn main() {
|
|||||||
t := Test1{}
|
t := Test1{}
|
||||||
|
|
||||||
t.test(fn [t] (t1 Test) {
|
t.test(fn [t] (t1 Test) {
|
||||||
println('$t, $t1')
|
println('${t}, ${t1}')
|
||||||
t.test(fn [t] (t2 Test) {
|
t.test(fn [t] (t2 Test) {
|
||||||
println('$t, $t2')
|
println('${t}, ${t2}')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ fn test_all() {
|
|||||||
vroot := os.dir(vexe)
|
vroot := os.dir(vexe)
|
||||||
os.chdir(vroot) or {}
|
os.chdir(vroot) or {}
|
||||||
diff_cmd := diff.find_working_diff_command() or { '' }
|
diff_cmd := diff.find_working_diff_command() or { '' }
|
||||||
dir := 'vlib/v/tests/inout'
|
dir := 'vlib/v/slow_tests/inout'
|
||||||
files := os.ls(dir) or { panic(err) }
|
files := os.ls(dir) or { panic(err) }
|
||||||
tests := files.filter(it.ends_with('.vv') || it.ends_with('.vsh'))
|
tests := files.filter(it.ends_with('.vv') || it.ends_with('.vsh'))
|
||||||
if tests.len == 0 {
|
if tests.len == 0 {
|
5
vlib/v/slow_tests/inout/comptime_if_script_mode.vv
Normal file
5
vlib/v/slow_tests/inout/comptime_if_script_mode.vv
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
$if vinix {
|
||||||
|
println('vinix')
|
||||||
|
} $else {
|
||||||
|
println('others')
|
||||||
|
}
|
32
vlib/v/slow_tests/inout/dump_expression.out
Normal file
32
vlib/v/slow_tests/inout/dump_expression.out
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:5] 1: 1
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:10] 'a': a
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:34] a: Aa{
|
||||||
|
log: &log.Logger(log.Log{
|
||||||
|
level: disabled
|
||||||
|
output_label: ''
|
||||||
|
ofile: os.File{
|
||||||
|
cfile: 0
|
||||||
|
fd: 0
|
||||||
|
is_opened: false
|
||||||
|
}
|
||||||
|
output_target: console
|
||||||
|
output_file_name: ''
|
||||||
|
})
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:35] p: Point{
|
||||||
|
x: 1
|
||||||
|
y: 2
|
||||||
|
z: 3
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:36] p_mut: Point{
|
||||||
|
x: 1
|
||||||
|
y: 2
|
||||||
|
z: 3
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:37] p_ptr: &Point{
|
||||||
|
x: 1
|
||||||
|
y: 2
|
||||||
|
z: 3
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:48] os.file_name(vfile): dump_expression.vv
|
||||||
|
[vlib/v/slow_tests/inout/dump_expression.vv:51] f.read(mut buf): 10
|
@ -18,7 +18,7 @@ mut:
|
|||||||
z int
|
z int
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Aa{
|
struct Aa {
|
||||||
log &log.Logger
|
log &log.Logger
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -27,7 +27,9 @@ fn dump_of_struct() {
|
|||||||
mut p_mut := Point{1, 2, 3}
|
mut p_mut := Point{1, 2, 3}
|
||||||
p_ptr := &Point{1, 2, 3}
|
p_ptr := &Point{1, 2, 3}
|
||||||
l := &log.Log{}
|
l := &log.Log{}
|
||||||
a := Aa{log:l}
|
a := Aa{
|
||||||
|
log: l
|
||||||
|
}
|
||||||
|
|
||||||
dump(a)
|
dump(a)
|
||||||
mut x1 := dump(p)
|
mut x1 := dump(p)
|
1
vlib/v/slow_tests/inout/dump_generic_fn_mut_arg.out
Normal file
1
vlib/v/slow_tests/inout/dump_generic_fn_mut_arg.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_generic_fn_mut_arg.vv:11] t: &Reptile{}
|
@ -0,0 +1,6 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:30] mi.in_(): 1.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:31] mi.out(): 2.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:36] in_put.in_(): 1.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:37] in_put.out(): 2.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:39] in_put.in_(): 1.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_generic_interface_ref_arg.vv:40] in_put.out(): 2.0
|
1
vlib/v/slow_tests/inout/dump_match_expr.out
Normal file
1
vlib/v/slow_tests/inout/dump_match_expr.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_match_expr.vv:3] ast.MatchExpr: 1
|
4
vlib/v/slow_tests/inout/dump_multiple_ptr.out
Normal file
4
vlib/v/slow_tests/inout/dump_multiple_ptr.out
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_multiple_ptr.vv:3] i: 42
|
||||||
|
[vlib/v/slow_tests/inout/dump_multiple_ptr.vv:5] ir: &42
|
||||||
|
[vlib/v/slow_tests/inout/dump_multiple_ptr.vv:7] irr: &&42
|
||||||
|
[vlib/v/slow_tests/inout/dump_multiple_ptr.vv:9] irrr: &&&42
|
@ -0,0 +1,23 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': int 1
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': int 1
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:36] next(1): 0.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': f64 1.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': f64 1.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:37] next(1.0): 64.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:19] '${T.name} $input': f64 11.1
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': f64 11.1
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:38] next(11.1): 64.0
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} $input': Score Score{
|
||||||
|
ave: 23.4
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': Score Score{
|
||||||
|
ave: 23.4
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:42] next(ave): 23.4
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:15] '${T.name} $input': &Score &Score{
|
||||||
|
ave: 23.4
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:26] '${T.name} $input': &Score &Score{
|
||||||
|
ave: 23.4
|
||||||
|
}
|
||||||
|
[vlib/v/slow_tests/inout/dump_nested_generic_fn_call_ref_arg.vv:43] next(&ave): 23.4
|
@ -12,18 +12,18 @@ pub fn (s &Score) ave() f64 {
|
|||||||
|
|
||||||
fn next[T](input T) f64 {
|
fn next[T](input T) f64 {
|
||||||
$if T is Average {
|
$if T is Average {
|
||||||
dump('${T.name} $input')
|
dump('${T.name} ${input}')
|
||||||
ret := next2[T](input)
|
ret := next2[T](input)
|
||||||
return ret
|
return ret
|
||||||
} $else {
|
} $else {
|
||||||
dump('${T.name} $input')
|
dump('${T.name} ${input}')
|
||||||
ret := next2[T](input)
|
ret := next2[T](input)
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn next2[T](input T) f64 {
|
fn next2[T](input T) f64 {
|
||||||
dump('${T.name} $input')
|
dump('${T.name} ${input}')
|
||||||
$if T is Average {
|
$if T is Average {
|
||||||
return input.ave()
|
return input.ave()
|
||||||
} $else $if T is f64 {
|
} $else $if T is f64 {
|
||||||
@ -36,7 +36,7 @@ fn main() {
|
|||||||
dump(next(1))
|
dump(next(1))
|
||||||
dump(next(1.0))
|
dump(next(1.0))
|
||||||
dump(next(11.1))
|
dump(next(11.1))
|
||||||
ave := Score {
|
ave := Score{
|
||||||
ave: 23.4
|
ave: 23.4
|
||||||
}
|
}
|
||||||
dump(next(ave))
|
dump(next(ave))
|
2
vlib/v/slow_tests/inout/dump_nil_voidptr.out
Normal file
2
vlib/v/slow_tests/inout/dump_nil_voidptr.out
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_nil_voidptr.vv:11] a: &nil
|
||||||
|
[vlib/v/slow_tests/inout/dump_nil_voidptr.vv:13] a: &nil
|
@ -3,7 +3,7 @@ fn get_nil() ?&int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn get_voidptr() ?&int {
|
fn get_voidptr() ?&int {
|
||||||
return voidptr(0)
|
return unsafe { nil }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
1
vlib/v/slow_tests/inout/dump_none.out
Normal file
1
vlib/v/slow_tests/inout/dump_none.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_none.vv:2] none: none
|
3
vlib/v/slow_tests/inout/dump_shared_arg.out
Normal file
3
vlib/v/slow_tests/inout/dump_shared_arg.out
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_shared_arg.vv:12] inst: &AtomicStruct{
|
||||||
|
a: 1
|
||||||
|
}
|
1
vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out
Normal file
1
vlib/v/slow_tests/inout/dump_sumtype_of_fntype.out
Normal file
@ -0,0 +1 @@
|
|||||||
|
[vlib/v/slow_tests/inout/dump_sumtype_of_fntype.vv:10] main.MyFnSumtype(main.f): MyFnSumtype(fn (int) v.ast.Expr)
|
@ -13,7 +13,9 @@ struct Aaa {
|
|||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
col := Color.green
|
col := Color.green
|
||||||
a := Aaa{color: col}
|
a := Aaa{
|
||||||
|
color: col
|
||||||
|
}
|
||||||
orange := Color.orange
|
orange := Color.orange
|
||||||
println(orange)
|
println(orange)
|
||||||
println(Color.yellow)
|
println(Color.yellow)
|
@ -1,4 +1,4 @@
|
|||||||
a := [1,2]!
|
a := [1, 2]!
|
||||||
println(a[0])
|
println(a[0])
|
||||||
i := 2
|
i := 2
|
||||||
_ = a[i]
|
_ = a[i]
|
@ -1,3 +1,3 @@
|
|||||||
a := [1,2]!
|
a := [1, 2]!
|
||||||
i := 3
|
i := 3
|
||||||
_ = a[i..i]
|
_ = a[i..i]
|
@ -1,5 +1,5 @@
|
|||||||
fn main(){
|
fn main() {
|
||||||
g := go print([1, 2, 3])
|
g := spawn print([1, 2, 3])
|
||||||
g.wait()
|
g.wait()
|
||||||
println('')
|
println('')
|
||||||
g2 := spawn print([4, 5, 6])
|
g2 := spawn print([4, 5, 6])
|
7
vlib/v/slow_tests/inout/hello_devs.vv
Normal file
7
vlib/v/slow_tests/inout/hello_devs.vv
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fn main() {
|
||||||
|
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded']
|
||||||
|
for i := 0; i < areas.len; i++ {
|
||||||
|
area := areas[i]
|
||||||
|
println('Hello, ${area} developers!')
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ fn (b &Bbb) print() {
|
|||||||
|
|
||||||
struct Aaa {
|
struct Aaa {
|
||||||
test bool
|
test bool
|
||||||
b Bbb
|
b Bbb
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
@ -2,4 +2,4 @@
|
|||||||
module: main
|
module: main
|
||||||
function: buggy_function()
|
function: buggy_function()
|
||||||
message: panicing...
|
message: panicing...
|
||||||
file: vlib/v/tests/inout/panic_with_cg.vv:3
|
file: vlib/v/slow_tests/inout/panic_with_cg.vv:2
|
@ -1,8 +1,7 @@
|
|||||||
|
|
||||||
fn buggy_function() {
|
fn buggy_function() {
|
||||||
panic('panicing...')
|
panic('panicing...')
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main(){
|
fn main() {
|
||||||
buggy_function()
|
buggy_function()
|
||||||
}
|
}
|
@ -8,5 +8,5 @@ fn main() {
|
|||||||
b := Byte(`a`)
|
b := Byte(`a`)
|
||||||
println(b)
|
println(b)
|
||||||
println(b.str())
|
println(b.str())
|
||||||
println('$b')
|
println('${b}')
|
||||||
}
|
}
|
@ -5,6 +5,6 @@ fn main() {
|
|||||||
|
|
||||||
fn proc[T](input T) {
|
fn proc[T](input T) {
|
||||||
$if T is &u8 {
|
$if T is &u8 {
|
||||||
println('T is $T.name')
|
println('T is ${T.name}')
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -13,7 +13,7 @@ fn abc(a Any) {
|
|||||||
}
|
}
|
||||||
if a is map[string]string {
|
if a is map[string]string {
|
||||||
for k, v in a {
|
for k, v in a {
|
||||||
println('> k: $k | v: $v')
|
println('> k: ${k} | v: ${v}')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println(@FN)
|
println(@FN)
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user