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

tests: enable test_generic_fn_with_variadics() test (#9944)

This commit is contained in:
yuyi 2021-05-01 17:52:47 +08:00 committed by GitHub
parent 605019ec27
commit f82f1977d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -345,12 +345,15 @@ fn test_generic_struct_print_array_as_field() {
assert foo.str() == 'Foo<[]string>{\n data: []\n}' assert foo.str() == 'Foo<[]string>{\n data: []\n}'
} }
/* struct Abc {
struct Abc{ x int y int z int } x int
y int
z int
}
fn p<T>(args ...T) { fn p<T>(args ...T) {
size := sizeof(T) size := sizeof(T)
print('p called with size: ${size:3d} | ') print('p called with size: ${size:3} | ')
for _, x in args { for _, x in args {
print(x) print(x)
print(' ') print(' ')
@ -370,7 +373,6 @@ fn test_generic_fn_with_variadics(){
p(abc) p(abc)
p('Good', 'morning', 'world') p('Good', 'morning', 'world')
} }
*/
struct Context {} struct Context {}
@ -392,24 +394,6 @@ fn test_pass_generic_to_nested_function() {
test(mut app) test(mut app)
} }
/*
struct NestedGeneric {}
fn (ng NestedGeneric) nested_test<T>(mut app T) {
app.context = Context {}
}
fn method_test<T>(mut app T) {
ng := NestedGeneric{}
ng.nested_test<T>(app)
}
fn test_pass_generic_to_nested_method() {
mut app := App{}
method_test(mut app)
}
*/
fn generic_return_map<M>() map[string]M { fn generic_return_map<M>() map[string]M {
return map{ return map{
'': M{} '': M{}