From 9d6b402df01ccd4e95410462a193825810955bfd Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 16 Jun 2020 12:23:52 +0200 Subject: [PATCH] test: fix sqlite_test.v --- vlib/sqlite/sqlite_test.v | 2 +- vlib/v/fmt/fmt.v | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/sqlite/sqlite_test.v b/vlib/sqlite/sqlite_test.v index d28b55ed42..a82673d586 100644 --- a/vlib/sqlite/sqlite_test.v +++ b/vlib/sqlite/sqlite_test.v @@ -4,7 +4,7 @@ fn test_sqlite() { $if !linux { return } - db := sqlite.connect(':memory:') + db := sqlite.connect(':memory:') or { panic(err) } db.exec("drop table if exists users") db.exec("create table users (id integer primary key, name text default '');") diff --git a/vlib/v/fmt/fmt.v b/vlib/v/fmt/fmt.v index 33af4dbc9c..a10d22da5e 100644 --- a/vlib/v/fmt/fmt.v +++ b/vlib/v/fmt/fmt.v @@ -509,7 +509,6 @@ pub fn (mut f Fmt) struct_field_expr(fexpr ast.Expr) { fn (f &Fmt) type_to_str(t table.Type) string { mut res := f.table.type_to_str(t) - for res.ends_with('_ptr') { // type_ptr => &type res = res[0..res.len - 4] @@ -703,6 +702,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) { } f.write(')') } + ast.SqlExpr {} ast.StringLiteral { if it.is_raw { f.write('r') @@ -721,7 +721,8 @@ pub fn (mut f Fmt) expr(node ast.Expr) { continue } f.write('$') - needs_fspec := it.need_fmts[i] || it.pluss[i] || (it.fills[i] && it.fwidths[i] >= 0) || it.fwidths[i] != 0 || it.precisions[i] != 0 + needs_fspec := it.need_fmts[i] || it.pluss[i] || (it.fills[i] && it.fwidths[i] >= + 0) || it.fwidths[i] != 0 || it.precisions[i] != 0 if needs_fspec || (it.exprs[i] !is ast.Ident && it.exprs[i] !is ast.SelectorExpr) { f.write('{') f.expr(it.exprs[i])