Skip to content

Commit

Permalink
checker: updated orm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edam committed Sep 21, 2023
1 parent bc2063d commit 3532ab7
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 34 deletions.
2 changes: 1 addition & 1 deletion vlib/v/checker/tests/orm_empty_struct.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vlib/v/checker/tests/orm_empty_struct.vv:9:15: error: V ORM: select: empty fields in `Person`
vlib/v/checker/tests/orm_empty_struct.vv:9:15: error: ORM: select: empty fields in `Person`
7 | db := sqlite.connect(':memory:')!
8 | _ := sql db {
9 | select from Person
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/checker/tests/orm_fkey_has_pkey.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vlib/v/checker/tests/orm_fkey_has_pkey.vv:5:2: error: V ORM: a struct that has a field that holds an array must have a primary key
vlib/v/checker/tests/orm_fkey_has_pkey.vv:5:2: error: ORM: a struct that has a field that holds an array must have a primary key
3 | struct Person {
4 | id int
5 | child []Child [fkey: 'person_id']
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/checker/tests/orm_fn_call_with_wrong_return_type.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vlib/v/checker/tests/orm_fn_call_with_wrong_return_type.vv:52:37: error: V ORM: function calls must return only primitive types and time.Time, but `get_second_child` returns `Child`
50 |
vlib/v/checker/tests/orm_fn_call_with_wrong_return_type.vv:52:37: error: ORM: function calls must return only primitive types and time.Time, but `get_second_child` returns `Child`
50 |
51 | steve := sql db {
52 | select from Parent where child == get_second_child()
| ~~~~~~~~~~~~~~~~~~
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
vlib/v/checker/tests/orm_left_side_expr_in_infix_expr_has_no_struct_field_error.vv:18:26: error: V ORM: left side of the `==` expression must be one of the `User`'s fields.
vlib/v/checker/tests/orm_left_side_expr_in_infix_expr_has_no_struct_field_error.vv:18:26: error: ORM: left side of the `==` expression must be one of the `User`'s fields.
1 possibility: `id`.
16 |
16 |
17 | users := sql db {
18 | select from User where first == second
| ~~~~~
Expand Down
4 changes: 2 additions & 2 deletions vlib/v/checker/tests/orm_limit_less_than_zero_error.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
vlib/v/checker/tests/orm_limit_less_than_zero_error.vv:18:26: error: V ORM: `limit` must be greater than or equal to zero
16 |
vlib/v/checker/tests/orm_limit_less_than_zero_error.vv:18:26: error: ORM: `limit` must be greater than or equal to zero
16 |
17 | users := sql db {
18 | select from User limit user_limit
| ~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/checker/tests/orm_multiple_pkeys.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vlib/v/checker/tests/orm_multiple_pkeys.vv:5:2: error: V ORM: a struct can only have one primary key
vlib/v/checker/tests/orm_multiple_pkeys.vv:5:2: error: ORM: a struct can only have one primary key
3 | struct Person {
4 | id int [primary]
5 | name string [primary]
Expand Down
2 changes: 1 addition & 1 deletion vlib/v/checker/tests/orm_not_a_struct.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vlib/v/checker/tests/orm_not_a_struct.vv:10:15: error: V ORM: the table symbol `Person` has to be a struct
vlib/v/checker/tests/orm_not_a_struct.vv:10:15: error: ORM: the table symbol `Person` has to be a struct
8 | db := sqlite.connect(':memory:')!
9 | _ := sql db {
10 | select from Person
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
vlib/v/checker/tests/orm_using_non_struct_field_in_order_by_error.vv:14:29: error: V ORM: `User` structure has no field with name `database`.
vlib/v/checker/tests/orm_using_non_struct_field_in_order_by_error.vv:14:29: error: ORM: `User` structure has no field with name `database`.
2 possibilities: `id`, `username`.
12 |
12 |
13 | users := sql db {
14 | select from User order by database
| ~~~~~~~~
15 | }!
16 |
vlib/v/checker/tests/orm_using_non_struct_field_in_order_by_error.vv:17:2: error: `println` can not print void expressions
15 | }!
16 |
16 |
17 | println(users)
| ~~~~~~~~~~~~~~
18 | }
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
vlib/v/checker/tests/orm_where_clause_unsupported_field_types_err.vv:15:29: error: V ORM: does not support array of primitive types
13 | bytes := [u8(0)]
14 | e := sql db {
15 | select from Example where example == bytes
| ~~~~~~~
16 | }!
17 | f := sql db {
Details:
field name: `example`
data type: `[]u8`
vlib/v/checker/tests/orm_where_clause_unsupported_field_types_err.vv:18:30: error: V ORM: does not support array of primitive types
16 | }!
17 | f := sql db {
18 | select from Example where (example == bytes)
| ~~~~~~~
19 | }!
20 | print(e)
Details:
field name: `example`
data type: `[]u8`
vlib/v/checker/tests/orm_where_clause_unsupported_field_types_err.vv:8:2: error: ORM: array fields must have an fkey attribute
6 | pub struct Example {
7 | id int [primary; sql: serial]
8 | example []u8 [sql_type: 'bytea'; unique]
| ~~~~~~~~~~~~
9 | }
10 |
2 changes: 1 addition & 1 deletion vlib/v/checker/tests/orm_wrong_where_expr_error.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vlib/v/checker/tests/orm_wrong_where_expr_error.vv:15:26: error: V ORM: `where` expression must have at least one comparison for filtering rows
vlib/v/checker/tests/orm_wrong_where_expr_error.vv:15:26: error: ORM: `where` expression must have at least one comparison for filtering rows
13 |
14 | users := sql db {
15 | select from User where 3
Expand Down

0 comments on commit 3532ab7

Please sign in to comment.