From d56d230489ced66ecc7ddac3d4dc7f526d044bfb Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 20 Aug 2024 09:56:47 +0800 Subject: [PATCH 1/2] test: fix like_operator_outside_orm_error.vv/.out --- vlib/v/checker/tests/like_operator_outside_orm_error.out | 9 +++++---- vlib/v/checker/tests/like_operator_outside_orm_error.vv | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/vlib/v/checker/tests/like_operator_outside_orm_error.out b/vlib/v/checker/tests/like_operator_outside_orm_error.out index ccc6cd4e8a5716..9860b1d49725bd 100644 --- a/vlib/v/checker/tests/like_operator_outside_orm_error.out +++ b/vlib/v/checker/tests/like_operator_outside_orm_error.out @@ -1,6 +1,7 @@ -vlib/v/checker/tests/like_operator_outside_orm_error.vv:4:15: error: unexpected name `like`, expecting `)` +vlib/v/checker/tests/like_operator_outside_orm_error.vv:3:14: error: only `c`, `r`, `js` are recognized string prefixes, but you tried to use `like` + 1 | fn main() { 2 | name := 'Luke' - 3 | - 4 | println(name like 'L%') - | ~~~~ + 3 | ret := name like 'L%' + | ~~~~ + 4 | println(ret) 5 | } diff --git a/vlib/v/checker/tests/like_operator_outside_orm_error.vv b/vlib/v/checker/tests/like_operator_outside_orm_error.vv index a5d0e006839835..9b95bea1b5ae68 100644 --- a/vlib/v/checker/tests/like_operator_outside_orm_error.vv +++ b/vlib/v/checker/tests/like_operator_outside_orm_error.vv @@ -1,5 +1,5 @@ fn main() { name := 'Luke' - - println(name like 'L%') + ret := name like 'L%' + println(ret) } From df9893f220bbc4023ea6fd1c05a05af7e9bbe13e Mon Sep 17 00:00:00 2001 From: yuyi Date: Tue, 20 Aug 2024 15:01:54 +0800 Subject: [PATCH 2/2] add a new test for it --- vlib/v/checker/tests/like_operator_outside_orm_1_error.out | 6 ++++++ vlib/v/checker/tests/like_operator_outside_orm_1_error.vv | 4 ++++ vlib/v/checker/tests/like_operator_outside_orm_2_error.out | 7 +++++++ ...e_orm_error.vv => like_operator_outside_orm_2_error.vv} | 0 vlib/v/checker/tests/like_operator_outside_orm_error.out | 7 ------- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 vlib/v/checker/tests/like_operator_outside_orm_1_error.out create mode 100644 vlib/v/checker/tests/like_operator_outside_orm_1_error.vv create mode 100644 vlib/v/checker/tests/like_operator_outside_orm_2_error.out rename vlib/v/checker/tests/{like_operator_outside_orm_error.vv => like_operator_outside_orm_2_error.vv} (100%) delete mode 100644 vlib/v/checker/tests/like_operator_outside_orm_error.out diff --git a/vlib/v/checker/tests/like_operator_outside_orm_1_error.out b/vlib/v/checker/tests/like_operator_outside_orm_1_error.out new file mode 100644 index 00000000000000..2c6c093ecc14e3 --- /dev/null +++ b/vlib/v/checker/tests/like_operator_outside_orm_1_error.out @@ -0,0 +1,6 @@ +vlib/v/checker/tests/like_operator_outside_orm_1_error.vv:3:15: error: unexpected name `like`, expecting `)` + 1 | fn main() { + 2 | name := 'Luke' + 3 | println(name like 'L%') + | ~~~~ + 4 | } diff --git a/vlib/v/checker/tests/like_operator_outside_orm_1_error.vv b/vlib/v/checker/tests/like_operator_outside_orm_1_error.vv new file mode 100644 index 00000000000000..23c10aa11d6e2e --- /dev/null +++ b/vlib/v/checker/tests/like_operator_outside_orm_1_error.vv @@ -0,0 +1,4 @@ +fn main() { + name := 'Luke' + println(name like 'L%') +} diff --git a/vlib/v/checker/tests/like_operator_outside_orm_2_error.out b/vlib/v/checker/tests/like_operator_outside_orm_2_error.out new file mode 100644 index 00000000000000..9251bb5e303d42 --- /dev/null +++ b/vlib/v/checker/tests/like_operator_outside_orm_2_error.out @@ -0,0 +1,7 @@ +vlib/v/checker/tests/like_operator_outside_orm_2_error.vv:3:14: error: only `c`, `r`, `js` are recognized string prefixes, but you tried to use `like` + 1 | fn main() { + 2 | name := 'Luke' + 3 | ret := name like 'L%' + | ~~~~ + 4 | println(ret) + 5 | } diff --git a/vlib/v/checker/tests/like_operator_outside_orm_error.vv b/vlib/v/checker/tests/like_operator_outside_orm_2_error.vv similarity index 100% rename from vlib/v/checker/tests/like_operator_outside_orm_error.vv rename to vlib/v/checker/tests/like_operator_outside_orm_2_error.vv diff --git a/vlib/v/checker/tests/like_operator_outside_orm_error.out b/vlib/v/checker/tests/like_operator_outside_orm_error.out deleted file mode 100644 index 9860b1d49725bd..00000000000000 --- a/vlib/v/checker/tests/like_operator_outside_orm_error.out +++ /dev/null @@ -1,7 +0,0 @@ -vlib/v/checker/tests/like_operator_outside_orm_error.vv:3:14: error: only `c`, `r`, `js` are recognized string prefixes, but you tried to use `like` - 1 | fn main() { - 2 | name := 'Luke' - 3 | ret := name like 'L%' - | ~~~~ - 4 | println(ret) - 5 | }