Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
40 changes: 40 additions & 0 deletions attribute/attribute_test.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,46 @@ let dummy_loc : @basic.Location = {
{ start: pos, end: pos }
}

///|
test "attribute payload accepts extend soft keyword" {
let pos = dummy_loc.start
let tokens : Array[(@tokens.Token, @basic.Position, @basic.Position)] = [
(@tokens.Token::LPAREN, pos, pos),
(@tokens.Token::EXTEND, pos, pos),
(@tokens.Token::COMMA, pos, pos),
(@tokens.Token::EXTEND, pos, pos),
(@tokens.Token::EQUAL, pos, pos),
(@tokens.Token::TRUE, pos, pos),
(@tokens.Token::COMMA, pos, pos),
(@tokens.Token::EXTEND, pos, pos),
(@tokens.Token::LPAREN, pos, pos),
(@tokens.Token::EXTEND, pos, pos),
(@tokens.Token::RPAREN, pos, pos),
(@tokens.Token::COMMA, pos, pos),
(@tokens.Token::EXTEND, pos, pos),
(@tokens.Token::DOT_LIDENT("field"), pos, pos),
(@tokens.Token::RPAREN, pos, pos),
(@tokens.Token::EOF, pos, pos),
]
try payloads(tokens, initial_pos=pos) catch {
_ => fail("expected extend soft keyword in attribute payload to parse")
} noraise {
props =>
debug_inspect(
props,
content=(
#|<List:
#| [
#| Expr(Ident(extend)),
#| Labeled("extend", Bool(true)),
#| Expr(Apply(extend, <List: [Expr(Ident(extend))]>)),
#| Expr(Ident(extend.field)),
#| ]>
),
)
}
}

///|
test "attribute" {
let attr = Attribute::new(loc=dummy_loc, ("qual", Some("name"), "(a,b,c)"))
Expand Down
Loading
Loading