From a594e009f2538bf1236e635255141f87e4a62678 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 7 Dec 2019 16:13:25 +0300 Subject: [PATCH] test high order function --- .github/workflows/ci.yml | 4 ++-- vlib/compiler/tests/fn_test.v | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5597ad9a0c..ff08520393 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,8 +41,8 @@ jobs: run: | brew services start postgresql sleep 3 - psql -c -d postgres -c 'select rolname from pg_roles' - psql -U postgres -d postgres -c 'create database customerdb;' + psql -d postgres -c 'select rolname from pg_roles' + psql -d postgres -c 'create database customerdb;' psql -d customerdb -f examples/database/pg/mydb.sql - name: Test v->c run: ./v test-compiler diff --git a/vlib/compiler/tests/fn_test.v b/vlib/compiler/tests/fn_test.v index d19b57d528..a48da30ec9 100644 --- a/vlib/compiler/tests/fn_test.v +++ b/vlib/compiler/tests/fn_test.v @@ -115,6 +115,21 @@ fn high_fn_multi_return(a int, b fn (c []int, d []string) ([]int, []string)) { } +fn sqr(x int) int { + return x * x +} + fn test_fns() { // no asserts for now, just test function declarations above + high_fn(sqr) +} + + +fn test_anon_fn() { + /* + high_fn(fn (x int) int { + println('hello') + return x + 1 + }) + */ }