1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/compiler/tests/fn_multiple_returns_test.v
Delyan Angelov 53c64abdeb compiler: make compiler an ordinary vlib/compiler module
* Move compiler/ under vlib/compiler/ .

* Add a minimal compiler/main.v driver program.

* Cleanup compiler/main.v .

* Make most compiler tests pass again.

* Apply the fix by @joe-conigliaro , so that the rest of the compiler tests are fixed too.

* Thanks to @avitkauskas, now the vlib/vcompiler/tests/str_gen_test.v test does not need to be special cased anymore.

* Reapply @joe-conigliaro fix for vgen.
2019-10-13 16:37:43 +03:00

20 lines
492 B
V

struct UserData {
test string
}
fn test_fn_multiple_returns() {
name, age, groups, data := fn_mr_get_user()
assert name == 'joe'
assert age == 34
assert groups[0] == 'admins'
assert groups[1] == 'users'
assert data.test == 'Test Data'
println('name: $name | age: $age | groups: ' + groups.join(',') + ' | data: $data.test')
}
fn fn_mr_get_user() (string, int, []string, UserData) {
groups := ['admins', 'users']
data := UserData{test: 'Test Data'}
return 'joe',34,groups,data
}