rename test cases for when/clause to somewhat match the file hierarchy.
This commit is contained in:
parent
bb01ddd7b5
commit
0650d6152d
|
@ -47,7 +47,7 @@ mod tests {
|
||||||
use crate::assert_expr;
|
use crate::assert_expr;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn todo_clause() {
|
fn when_clause_todo() {
|
||||||
assert_expr!(
|
assert_expr!(
|
||||||
r#"
|
r#"
|
||||||
when val is {
|
when val is {
|
||||||
|
@ -59,7 +59,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn error_single_clause_no_message() {
|
fn when_clause_solo_error() {
|
||||||
assert_expr!(
|
assert_expr!(
|
||||||
r#"
|
r#"
|
||||||
when val is {
|
when val is {
|
||||||
|
@ -70,7 +70,7 @@ mod tests {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn todo_double_clause_no_message() {
|
fn when_clause_double_todo() {
|
||||||
assert_expr!(
|
assert_expr!(
|
||||||
r#"
|
r#"
|
||||||
when val is {
|
when val is {
|
||||||
|
|
|
@ -0,0 +1,67 @@
|
||||||
|
---
|
||||||
|
source: crates/aiken-lang/src/parser/expr/when/clause.rs
|
||||||
|
description: "Code:\n\nwhen val is {\n Bar1{..} -> todo\n Bar2{..} -> todo\n}\n"
|
||||||
|
---
|
||||||
|
When {
|
||||||
|
location: 0..53,
|
||||||
|
subject: Var {
|
||||||
|
location: 5..8,
|
||||||
|
name: "val",
|
||||||
|
},
|
||||||
|
clauses: [
|
||||||
|
UntypedClause {
|
||||||
|
location: 16..32,
|
||||||
|
patterns: [
|
||||||
|
Constructor {
|
||||||
|
is_record: true,
|
||||||
|
location: 16..24,
|
||||||
|
name: "Bar1",
|
||||||
|
arguments: [],
|
||||||
|
module: None,
|
||||||
|
constructor: (),
|
||||||
|
with_spread: true,
|
||||||
|
tipo: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
guard: None,
|
||||||
|
then: Trace {
|
||||||
|
kind: Todo,
|
||||||
|
location: 28..32,
|
||||||
|
then: ErrorTerm {
|
||||||
|
location: 28..32,
|
||||||
|
},
|
||||||
|
text: String {
|
||||||
|
location: 28..32,
|
||||||
|
value: "aiken::todo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
UntypedClause {
|
||||||
|
location: 35..51,
|
||||||
|
patterns: [
|
||||||
|
Constructor {
|
||||||
|
is_record: true,
|
||||||
|
location: 35..43,
|
||||||
|
name: "Bar2",
|
||||||
|
arguments: [],
|
||||||
|
module: None,
|
||||||
|
constructor: (),
|
||||||
|
with_spread: true,
|
||||||
|
tipo: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
guard: None,
|
||||||
|
then: Trace {
|
||||||
|
kind: Todo,
|
||||||
|
location: 47..51,
|
||||||
|
then: ErrorTerm {
|
||||||
|
location: 47..51,
|
||||||
|
},
|
||||||
|
text: String {
|
||||||
|
location: 47..51,
|
||||||
|
value: "aiken::todo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
---
|
||||||
|
source: crates/aiken-lang/src/parser/expr/when/clause.rs
|
||||||
|
description: "Code:\n\nwhen val is {\n Bar1{..} -> error\n}\n"
|
||||||
|
---
|
||||||
|
When {
|
||||||
|
location: 0..35,
|
||||||
|
subject: Var {
|
||||||
|
location: 5..8,
|
||||||
|
name: "val",
|
||||||
|
},
|
||||||
|
clauses: [
|
||||||
|
UntypedClause {
|
||||||
|
location: 16..33,
|
||||||
|
patterns: [
|
||||||
|
Constructor {
|
||||||
|
is_record: true,
|
||||||
|
location: 16..24,
|
||||||
|
name: "Bar1",
|
||||||
|
arguments: [],
|
||||||
|
module: None,
|
||||||
|
constructor: (),
|
||||||
|
with_spread: true,
|
||||||
|
tipo: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
guard: None,
|
||||||
|
then: Trace {
|
||||||
|
kind: Error,
|
||||||
|
location: 28..33,
|
||||||
|
then: ErrorTerm {
|
||||||
|
location: 28..33,
|
||||||
|
},
|
||||||
|
text: String {
|
||||||
|
location: 28..33,
|
||||||
|
value: "aiken::error",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
---
|
||||||
|
source: crates/aiken-lang/src/parser/expr/when/clause.rs
|
||||||
|
description: "Code:\n\nwhen val is {\n Bar1{..} -> True\n Bar2{..} -> todo @\"unimplemented\"\n}\n"
|
||||||
|
---
|
||||||
|
When {
|
||||||
|
location: 0..70,
|
||||||
|
subject: Var {
|
||||||
|
location: 5..8,
|
||||||
|
name: "val",
|
||||||
|
},
|
||||||
|
clauses: [
|
||||||
|
UntypedClause {
|
||||||
|
location: 16..32,
|
||||||
|
patterns: [
|
||||||
|
Constructor {
|
||||||
|
is_record: true,
|
||||||
|
location: 16..24,
|
||||||
|
name: "Bar1",
|
||||||
|
arguments: [],
|
||||||
|
module: None,
|
||||||
|
constructor: (),
|
||||||
|
with_spread: true,
|
||||||
|
tipo: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
guard: None,
|
||||||
|
then: Var {
|
||||||
|
location: 28..32,
|
||||||
|
name: "True",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
UntypedClause {
|
||||||
|
location: 35..68,
|
||||||
|
patterns: [
|
||||||
|
Constructor {
|
||||||
|
is_record: true,
|
||||||
|
location: 35..43,
|
||||||
|
name: "Bar2",
|
||||||
|
arguments: [],
|
||||||
|
module: None,
|
||||||
|
constructor: (),
|
||||||
|
with_spread: true,
|
||||||
|
tipo: (),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
guard: None,
|
||||||
|
then: Trace {
|
||||||
|
kind: Todo,
|
||||||
|
location: 47..68,
|
||||||
|
then: ErrorTerm {
|
||||||
|
location: 47..68,
|
||||||
|
},
|
||||||
|
text: String {
|
||||||
|
location: 52..68,
|
||||||
|
value: "unimplemented",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
Loading…
Reference in New Issue