feat(expect): update formatter

* Token::Expect should format to expect
* since we still capture assert this means
  we can help users update to the new syntax
This commit is contained in:
rvcas 2023-02-09 00:57:38 -05:00
parent 6f591c633d
commit 9348caab2f
No known key found for this signature in database
GPG Key ID: C09B64E263F7D68C
3 changed files with 5 additions and 5 deletions

View File

@ -606,7 +606,7 @@ impl<'comments> Formatter<'comments> {
let keyword = match kind { let keyword = match kind {
Some(AssignmentKind::Let) => "let ", Some(AssignmentKind::Let) => "let ",
Some(AssignmentKind::Expect) => "assert ", Some(AssignmentKind::Expect) => "expect ",
None => "try ", None => "try ",
}; };

View File

@ -28,6 +28,6 @@ test update_owner1() {
builtin.list_data([]), builtin.list_data([]),
], ],
) )
assert Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car expect Ford { owner, wheels, truck_bed_limit, .. }: Car = initial_car
owner == #"" && wheels == 4 && truck_bed_limit == 10000 owner == #"" && wheels == 4 && truck_bed_limit == 10000
} }

View File

@ -13,19 +13,19 @@ test let_1() {
test let_2() { test let_2() {
let x: Data = 1 let x: Data = 1
assert y: Int = x expect y: Int = x
y == 1 y == 1
} }
test assert_1() { test assert_1() {
assert thing: Thing = builtin.constr_data(0, [builtin.i_data(1)]) expect thing: Thing = builtin.constr_data(0, [builtin.i_data(1)])
thing.wow == 1 thing.wow == 1
} }
fn cast_to_thing(x: Data) -> Thing { fn cast_to_thing(x: Data) -> Thing {
assert x: Thing = x expect x: Thing = x
x x
} }