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:
parent
6f591c633d
commit
9348caab2f
|
@ -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 ",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue