MCPcopy Create free account
hub / github.com/PRQL/prql / test_annotation

Function test_annotation

prqlc/prqlc-parser/src/test.rs:1714–1788  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1712
1713#[test]
1714fn test_annotation() {
1715 assert_yaml_snapshot!(parse_source(r#"
1716 @{binding_strength=1}
1717 let add = a b -> a + b
1718 "#).unwrap(), @r#"
1719 - VarDef:
1720 kind: Let
1721 name: add
1722 value:
1723 Func:
1724 return_ty: ~
1725 body:
1726 Binary:
1727 left:
1728 Ident:
1729 - a
1730 span: "0:56-57"
1731 op: Add
1732 right:
1733 Ident:
1734 - b
1735 span: "0:60-61"
1736 span: "0:56-61"
1737 params:
1738 - name: a
1739 default_value: ~
1740 - name: b
1741 default_value: ~
1742 named_params: []
1743 span: "0:49-61"
1744 span: "0:0-61"
1745 annotations:
1746 - expr:
1747 Tuple:
1748 - Literal:
1749 Integer: 1
1750 span: "0:28-29"
1751 alias: binding_strength
1752 span: "0:10-30"
1753 "#);
1754 parse_source(
1755 r#"
1756 @{binding_strength=1}
1757 let add = a b -> a + b
1758 "#,
1759 )
1760 .unwrap();
1761
1762 parse_source(
1763 r#"
1764 @{binding_strength=1}
1765 # comment
1766 let add = a b -> a + b
1767 "#,
1768 )
1769 .unwrap();
1770
1771 parse_source(

Callers

nothing calls this directly

Calls 1

parse_sourceFunction · 0.70

Tested by

no test coverage detected