mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 19:32:17 +00:00
add snapshot test
This commit is contained in:
parent
cce33c03d6
commit
05f970a826
1 changed files with 289 additions and 0 deletions
|
@ -0,0 +1,289 @@
|
||||||
|
---
|
||||||
|
source: crates/compiler/can/tests/test_suffixed.rs
|
||||||
|
expression: snapshot
|
||||||
|
---
|
||||||
|
Defs {
|
||||||
|
tags: [
|
||||||
|
Index(2147483648),
|
||||||
|
Index(2147483649),
|
||||||
|
Index(2147483650),
|
||||||
|
],
|
||||||
|
regions: [
|
||||||
|
@0-80,
|
||||||
|
@82-227,
|
||||||
|
@229-266,
|
||||||
|
],
|
||||||
|
space_before: [
|
||||||
|
Slice(start = 0, length = 0),
|
||||||
|
Slice(start = 0, length = 2),
|
||||||
|
Slice(start = 2, length = 2),
|
||||||
|
],
|
||||||
|
space_after: [
|
||||||
|
Slice(start = 0, length = 0),
|
||||||
|
Slice(start = 2, length = 0),
|
||||||
|
Slice(start = 4, length = 1),
|
||||||
|
],
|
||||||
|
spaces: [
|
||||||
|
Newline,
|
||||||
|
Newline,
|
||||||
|
Newline,
|
||||||
|
Newline,
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
type_defs: [],
|
||||||
|
value_defs: [
|
||||||
|
Body(
|
||||||
|
@0-3 Identifier {
|
||||||
|
ident: "inc",
|
||||||
|
},
|
||||||
|
@6-80 Closure(
|
||||||
|
[
|
||||||
|
@7-8 Identifier {
|
||||||
|
ident: "i",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
@16-80 If {
|
||||||
|
if_thens: [
|
||||||
|
(
|
||||||
|
@19-24 Apply(
|
||||||
|
@21-22 Var {
|
||||||
|
module_name: "Num",
|
||||||
|
ident: "isGt",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@19-20 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "i",
|
||||||
|
},
|
||||||
|
@23-24 Num(
|
||||||
|
"2",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
BinOp(
|
||||||
|
GreaterThan,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
@38-52 Apply(
|
||||||
|
@38-41 Tag(
|
||||||
|
"Err",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@42-52 Tag(
|
||||||
|
"MaxReached",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
final_else: @70-80 Apply(
|
||||||
|
@70-72 Tag(
|
||||||
|
"Ok",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@74-79 ParensAround(
|
||||||
|
Apply(
|
||||||
|
@76-77 Var {
|
||||||
|
module_name: "Num",
|
||||||
|
ident: "add",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@74-75 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "i",
|
||||||
|
},
|
||||||
|
@78-79 Num(
|
||||||
|
"1",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
BinOp(
|
||||||
|
Plus,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
indented_else: false,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Expect {
|
||||||
|
condition: @93-227 Defs(
|
||||||
|
Defs {
|
||||||
|
tags: [
|
||||||
|
Index(2147483648),
|
||||||
|
Index(2147483649),
|
||||||
|
],
|
||||||
|
regions: [
|
||||||
|
@99-189,
|
||||||
|
@203-208,
|
||||||
|
],
|
||||||
|
space_before: [
|
||||||
|
Slice(start = 0, length = 0),
|
||||||
|
Slice(start = 0, length = 1),
|
||||||
|
],
|
||||||
|
space_after: [
|
||||||
|
Slice(start = 0, length = 0),
|
||||||
|
Slice(start = 1, length = 0),
|
||||||
|
],
|
||||||
|
spaces: [
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
type_defs: [],
|
||||||
|
value_defs: [
|
||||||
|
Body(
|
||||||
|
@93-96 Identifier {
|
||||||
|
ident: "run",
|
||||||
|
},
|
||||||
|
@99-189 Closure(
|
||||||
|
[
|
||||||
|
@100-101 Identifier {
|
||||||
|
ident: "i",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
@132-172 Apply(
|
||||||
|
@132-172 Var {
|
||||||
|
module_name: "Result",
|
||||||
|
ident: "try",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@132-152 Apply(
|
||||||
|
@132-152 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "inc",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@132-133 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "i",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
BinOp(
|
||||||
|
Pizza,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
@132-172 Closure(
|
||||||
|
[
|
||||||
|
@132-152 Identifier {
|
||||||
|
ident: "#!0_arg",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
@132-172 Apply(
|
||||||
|
@132-172 Var {
|
||||||
|
module_name: "Result",
|
||||||
|
ident: "try",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@132-172 Apply(
|
||||||
|
@132-172 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "inc",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@132-152 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "#!0_arg",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
BinOp(
|
||||||
|
Pizza,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
@132-172 Closure(
|
||||||
|
[
|
||||||
|
@113-117 Identifier {
|
||||||
|
ident: "newi",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
@182-189 Apply(
|
||||||
|
@182-184 Tag(
|
||||||
|
"Ok",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@185-189 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "newi",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
QuestionSuffix,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
QuestionSuffix,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Body(
|
||||||
|
@194-200 Identifier {
|
||||||
|
ident: "result",
|
||||||
|
},
|
||||||
|
@203-208 Apply(
|
||||||
|
@203-206 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "run",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@207-208 Num(
|
||||||
|
"0",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
@213-227 Apply(
|
||||||
|
@220-222 Var {
|
||||||
|
module_name: "Bool",
|
||||||
|
ident: "isEq",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@213-219 Var {
|
||||||
|
module_name: "",
|
||||||
|
ident: "result",
|
||||||
|
},
|
||||||
|
@223-227 Apply(
|
||||||
|
@223-225 Tag(
|
||||||
|
"Ok",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@226-227 Num(
|
||||||
|
"2",
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
BinOp(
|
||||||
|
Equals,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
preceding_comment: @82-82,
|
||||||
|
},
|
||||||
|
Body(
|
||||||
|
@229-233 Identifier {
|
||||||
|
ident: "main",
|
||||||
|
},
|
||||||
|
@240-266 Apply(
|
||||||
|
@240-266 Var {
|
||||||
|
module_name: "Stdout",
|
||||||
|
ident: "line",
|
||||||
|
},
|
||||||
|
[
|
||||||
|
@253-266 Str(
|
||||||
|
PlainLine(
|
||||||
|
"Hello world",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue