From b2f05e56b8c47a0c6567d55b69e8545431fe6a0e Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 19 Mar 2020 11:23:02 +0100 Subject: [PATCH] cgen: fix tests --- vlib/time/parse.v | 3 ++- vlib/v/gen/tests/1.c | 2 +- vlib/v/gen/tests/3.vv | 11 +++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/vlib/time/parse.v b/vlib/time/parse.v index e883fe92e1..d97c162aff 100644 --- a/vlib/time/parse.v +++ b/vlib/time/parse.v @@ -19,7 +19,7 @@ pub fn parse(s string) ?Time { minute := hms[1] second := hms[2] - return new_time(Time{ + res := new_time(Time{ year: ymd[0].int() month: ymd[1].int() day: ymd[2].int() @@ -27,6 +27,7 @@ pub fn parse(s string) ?Time { minute: minute.int() second: second.int() }) + return res } // parse_rfc2822 returns time from a date string in RFC 2822 datetime format. diff --git a/vlib/v/gen/tests/1.c b/vlib/v/gen/tests/1.c index d85b2fff52..3f65b6cba2 100644 --- a/vlib/v/gen/tests/1.c +++ b/vlib/v/gen/tests/1.c @@ -102,7 +102,7 @@ i < 10; i++) { bool b2 = (*(bool*)array_get(bools, 0)) || true; bool b3 = get_bool() || true; int f = array_first(nums); - array_int c = array_clone(nums); + array_int c = array_clone(&nums); string d = tos3("d"); println(string_add(s, d)); } diff --git a/vlib/v/gen/tests/3.vv b/vlib/v/gen/tests/3.vv index 63092d63a6..fd3ac63668 100644 --- a/vlib/v/gen/tests/3.vv +++ b/vlib/v/gen/tests/3.vv @@ -12,6 +12,17 @@ fn get_opt() ?int { return 0 } +/* +fn new_user() User { + return User{} +} + +fn get_user_opt() ?User { + return new_user() + //return User{age:20, name:'Peter'} +} +*/ + fn (u &User) foo() { age := u.age zzz := [''].repeat(u.age)