test(parser): record create
This commit is contained in:
@@ -122,39 +122,6 @@ fn call() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn record_create_labeled() {
|
||||
assert_module!(
|
||||
r#"
|
||||
fn create() {
|
||||
User { name: "Aiken", age, thing: 2 }
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn record_create_labeled_with_field_access() {
|
||||
assert_module!(
|
||||
r#"
|
||||
fn create() {
|
||||
some_module.User { name: "Aiken", age, thing: 2 }
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cargo_create_unlabeled() {
|
||||
assert_module!(
|
||||
r#"
|
||||
fn create() {
|
||||
some_module.Thing(1, a)
|
||||
}
|
||||
"#
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_tuple() {
|
||||
assert_module!(
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
---
|
||||
source: crates/aiken-lang/src/tests/parser.rs
|
||||
description: "Code:\n\nfn create() {\n some_module.Thing(1, a)\n}\n"
|
||||
---
|
||||
Module {
|
||||
name: "",
|
||||
docs: [],
|
||||
type_info: (),
|
||||
definitions: [
|
||||
Fn(
|
||||
Function {
|
||||
arguments: [],
|
||||
body: Call {
|
||||
arguments: [
|
||||
CallArg {
|
||||
label: None,
|
||||
location: 34..35,
|
||||
value: Int {
|
||||
location: 34..35,
|
||||
value: "1",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
CallArg {
|
||||
label: None,
|
||||
location: 37..38,
|
||||
value: Var {
|
||||
location: 37..38,
|
||||
name: "a",
|
||||
},
|
||||
},
|
||||
],
|
||||
fun: FieldAccess {
|
||||
location: 16..33,
|
||||
label: "Thing",
|
||||
container: Var {
|
||||
location: 16..27,
|
||||
name: "some_module",
|
||||
},
|
||||
},
|
||||
location: 16..39,
|
||||
},
|
||||
doc: None,
|
||||
location: 0..11,
|
||||
name: "create",
|
||||
public: false,
|
||||
return_annotation: None,
|
||||
return_type: (),
|
||||
end_position: 40,
|
||||
can_error: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
kind: Validator,
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
---
|
||||
source: crates/aiken-lang/src/tests/parser.rs
|
||||
description: "Code:\n\nfn create() {\n User { name: \"Aiken\", age, thing: 2 }\n}\n"
|
||||
---
|
||||
Module {
|
||||
name: "",
|
||||
docs: [],
|
||||
type_info: (),
|
||||
definitions: [
|
||||
Fn(
|
||||
Function {
|
||||
arguments: [],
|
||||
body: Call {
|
||||
arguments: [
|
||||
CallArg {
|
||||
label: Some(
|
||||
"name",
|
||||
),
|
||||
location: 23..36,
|
||||
value: ByteArray {
|
||||
location: 29..36,
|
||||
bytes: [
|
||||
65,
|
||||
105,
|
||||
107,
|
||||
101,
|
||||
110,
|
||||
],
|
||||
preferred_format: Utf8String,
|
||||
},
|
||||
},
|
||||
CallArg {
|
||||
label: Some(
|
||||
"age",
|
||||
),
|
||||
location: 38..41,
|
||||
value: Var {
|
||||
location: 38..41,
|
||||
name: "age",
|
||||
},
|
||||
},
|
||||
CallArg {
|
||||
label: Some(
|
||||
"thing",
|
||||
),
|
||||
location: 43..51,
|
||||
value: Int {
|
||||
location: 50..51,
|
||||
value: "2",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
fun: Var {
|
||||
location: 16..20,
|
||||
name: "User",
|
||||
},
|
||||
location: 16..53,
|
||||
},
|
||||
doc: None,
|
||||
location: 0..11,
|
||||
name: "create",
|
||||
public: false,
|
||||
return_annotation: None,
|
||||
return_type: (),
|
||||
end_position: 54,
|
||||
can_error: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
kind: Validator,
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
---
|
||||
source: crates/aiken-lang/src/tests/parser.rs
|
||||
description: "Code:\n\nfn create() {\n some_module.User { name: \"Aiken\", age, thing: 2 }\n}\n"
|
||||
---
|
||||
Module {
|
||||
name: "",
|
||||
docs: [],
|
||||
type_info: (),
|
||||
definitions: [
|
||||
Fn(
|
||||
Function {
|
||||
arguments: [],
|
||||
body: Call {
|
||||
arguments: [
|
||||
CallArg {
|
||||
label: Some(
|
||||
"name",
|
||||
),
|
||||
location: 35..48,
|
||||
value: ByteArray {
|
||||
location: 41..48,
|
||||
bytes: [
|
||||
65,
|
||||
105,
|
||||
107,
|
||||
101,
|
||||
110,
|
||||
],
|
||||
preferred_format: Utf8String,
|
||||
},
|
||||
},
|
||||
CallArg {
|
||||
label: Some(
|
||||
"age",
|
||||
),
|
||||
location: 50..53,
|
||||
value: Var {
|
||||
location: 50..53,
|
||||
name: "age",
|
||||
},
|
||||
},
|
||||
CallArg {
|
||||
label: Some(
|
||||
"thing",
|
||||
),
|
||||
location: 55..63,
|
||||
value: Int {
|
||||
location: 62..63,
|
||||
value: "2",
|
||||
base: Decimal {
|
||||
numeric_underscore: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
fun: FieldAccess {
|
||||
location: 16..32,
|
||||
label: "User",
|
||||
container: Var {
|
||||
location: 16..27,
|
||||
name: "some_module",
|
||||
},
|
||||
},
|
||||
location: 16..65,
|
||||
},
|
||||
doc: None,
|
||||
location: 0..11,
|
||||
name: "create",
|
||||
public: false,
|
||||
return_annotation: None,
|
||||
return_type: (),
|
||||
end_position: 66,
|
||||
can_error: true,
|
||||
},
|
||||
),
|
||||
],
|
||||
kind: Validator,
|
||||
}
|
||||
Reference in New Issue
Block a user