diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-19 00:03:47 +0200 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-08-19 00:03:47 +0200 |
| commit | d8ec8c5c098ae2829e4916d7a33b6dbe7d515df7 (patch) | |
| tree | 18fafd4ebda4100cdfb404048a22e6f1a3340f31 /tools/odinfmt/tests | |
| parent | 599c906489bab115bf79cbde30e28a46eba2d4d2 (diff) | |
Fix ternary expression not breaking correctly.
Diffstat (limited to 'tools/odinfmt/tests')
| -rw-r--r-- | tools/odinfmt/tests/.snapshots/attributes.odin | 2 | ||||
| -rw-r--r-- | tools/odinfmt/tests/.snapshots/returns.odin | 9 | ||||
| -rw-r--r-- | tools/odinfmt/tests/.snapshots/ternary.odin | 17 | ||||
| -rw-r--r-- | tools/odinfmt/tests/attributes.odin | 2 | ||||
| -rw-r--r-- | tools/odinfmt/tests/returns.odin | 9 | ||||
| -rw-r--r-- | tools/odinfmt/tests/ternary.odin | 12 |
6 files changed, 51 insertions, 0 deletions
diff --git a/tools/odinfmt/tests/.snapshots/attributes.odin b/tools/odinfmt/tests/.snapshots/attributes.odin index a6eaa65..58dd5f8 100644 --- a/tools/odinfmt/tests/.snapshots/attributes.odin +++ b/tools/odinfmt/tests/.snapshots/attributes.odin @@ -6,3 +6,5 @@ main :: proc() { #no_bounds_check buf = buf[8:] } + +procedure_no_bounds_check :: proc() where 1 == 1 #no_bounds_check {} diff --git a/tools/odinfmt/tests/.snapshots/returns.odin b/tools/odinfmt/tests/.snapshots/returns.odin index 85996b7..0b6dd10 100644 --- a/tools/odinfmt/tests/.snapshots/returns.odin +++ b/tools/odinfmt/tests/.snapshots/returns.odin @@ -17,3 +17,12 @@ return_without_paren_1 :: proc() { GRADIENTS_4D[gi | 3] * delta.w \ ) } + +returns_with_call_expression :: proc() { + return resolve_type_comp_literal( + ast_context, + position_context, + symbol, + cast(^ast.Comp_Lit)field_value.value, + ) +} diff --git a/tools/odinfmt/tests/.snapshots/ternary.odin b/tools/odinfmt/tests/.snapshots/ternary.odin new file mode 100644 index 0000000..50d48fb --- /dev/null +++ b/tools/odinfmt/tests/.snapshots/ternary.odin @@ -0,0 +1,17 @@ +package odinfmt_test + + +main :: proc() { + a := + .Group in options \ + ? group(visit_expr(p, expr, called_from, options)) \ + : visit_expr(p, expr, called_from, options) + + + document = cons( + document, + .Group in options \ + ? group(visit_expr(p, expr, called_from, options)) \ + : visit_expr(p, expr, called_from, options), + ) +} diff --git a/tools/odinfmt/tests/attributes.odin b/tools/odinfmt/tests/attributes.odin index a6eaa65..6e55c21 100644 --- a/tools/odinfmt/tests/attributes.odin +++ b/tools/odinfmt/tests/attributes.odin @@ -6,3 +6,5 @@ main :: proc() { #no_bounds_check buf = buf[8:] } + +procedure_no_bounds_check :: proc() where 1 == 1 #no_bounds_check {}
\ No newline at end of file diff --git a/tools/odinfmt/tests/returns.odin b/tools/odinfmt/tests/returns.odin index f4ff400..2359308 100644 --- a/tools/odinfmt/tests/returns.odin +++ b/tools/odinfmt/tests/returns.odin @@ -13,4 +13,13 @@ return_without_paren_1 :: proc() { return GRADIENTS_4D[gi] * delta.x + GRADIENTS_4D[gi | 1] * delta.y + GRADIENTS_4D[gi | 2] * delta.z + GRADIENTS_4D[gi | 3] * delta.w +} + +returns_with_call_expression :: proc() { + return resolve_type_comp_literal( + ast_context, + position_context, + symbol, + cast(^ast.Comp_Lit)field_value.value, + ) }
\ No newline at end of file diff --git a/tools/odinfmt/tests/ternary.odin b/tools/odinfmt/tests/ternary.odin new file mode 100644 index 0000000..5eb044e --- /dev/null +++ b/tools/odinfmt/tests/ternary.odin @@ -0,0 +1,12 @@ +package odinfmt_test + + +main :: proc() { + a := .Group in options ? group(visit_expr(p, expr, called_from, options)) : visit_expr(p, expr, called_from, options) + + + document = cons( + document, + .Group in options ? group(visit_expr(p, expr, called_from, options)) : visit_expr(p, expr, called_from, options), + ) +}
\ No newline at end of file |