MCPcopy Create free account
hub / github.com/GraphiteEditor/Graphite / test_node_with_impl_node

Function test_node_with_impl_node

node-graph/node-macro/src/parsing.rs:1129–1213  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1127
1128 #[test]
1129 fn test_node_with_impl_node() {
1130 let attr = quote!(category("General"));
1131 let input = quote!(
1132 /**
1133 Hello
1134 World
1135 */
1136 fn transform<T: 'static>(footprint: Footprint, transform_target: impl Node<Footprint, Output = T>, translate: DVec2) -> T {
1137 // Implementation details...
1138 }
1139 );
1140
1141 let parsed = parse_node_fn(attr, input).unwrap();
1142 let expected = ParsedNodeFn {
1143 vis: Visibility::Inherited,
1144 attributes: NodeFnAttributes {
1145 category: Some(parse_quote!("General")),
1146 display_name: None,
1147 path: None,
1148 skip_impl: false,
1149 properties_string: None,
1150 cfg: None,
1151 shader_node: None,
1152 serialize: None,
1153 memoize: false,
1154 inject_scope: false,
1155 },
1156 fn_name: Ident::new("transform", Span::call_site()),
1157 struct_name: Ident::new("Transform", Span::call_site()),
1158 mod_name: Ident::new("transform", Span::call_site()),
1159 fn_generics: vec![parse_quote!(T: 'static)],
1160 where_clause: None,
1161 input: Input {
1162 pat_ident: pat_ident("footprint"),
1163 ty: parse_quote!(Footprint),
1164 implementations: Punctuated::new(),
1165 context_features: vec![],
1166 },
1167 output_type: parse_quote!(T),
1168 is_async: false,
1169 fields: vec![
1170 ParsedField {
1171 pat_ident: pat_ident("transform_target"),
1172 name: None,
1173 description: String::new(),
1174 widget_override: ParsedWidgetOverride::None,
1175 ty: ParsedFieldType::Node(NodeParsedField {
1176 input_type: parse_quote!(Footprint),
1177 output_type: parse_quote!(T),
1178 implementations: Punctuated::new(),
1179 }),
1180 number_display_decimal_places: None,
1181 number_step: None,
1182 unit: None,
1183 is_data_field: false,
1184 },
1185 ParsedField {
1186 pat_ident: pat_ident("translate"),

Callers

nothing calls this directly

Calls 3

parse_node_fnFunction · 0.85
pat_identFunction · 0.85
assert_parsed_node_fnFunction · 0.85

Tested by

no test coverage detected