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

Function test_async_node

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

Source from the content-addressed store, hash-verified

1440
1441 #[test]
1442 fn test_async_node() {
1443 let attr = quote!(category("IO"));
1444 let input = quote!(
1445 async fn load_image(api: &PlatformEditorApi, #[expose] path: String) -> List<Raster<CPU>> {
1446 // Implementation details...
1447 }
1448 );
1449
1450 let parsed = parse_node_fn(attr, input).unwrap();
1451 let expected = ParsedNodeFn {
1452 vis: Visibility::Inherited,
1453 attributes: NodeFnAttributes {
1454 category: Some(parse_quote!("IO")),
1455 display_name: None,
1456 path: None,
1457 skip_impl: false,
1458 properties_string: None,
1459 cfg: None,
1460 shader_node: None,
1461 serialize: None,
1462 memoize: false,
1463 inject_scope: false,
1464 },
1465 fn_name: Ident::new("load_image", Span::call_site()),
1466 struct_name: Ident::new("LoadImage", Span::call_site()),
1467 mod_name: Ident::new("load_image", Span::call_site()),
1468 fn_generics: vec![],
1469 where_clause: None,
1470 input: Input {
1471 pat_ident: pat_ident("api"),
1472 ty: parse_quote!(&PlatformEditorApi),
1473 implementations: Punctuated::new(),
1474 context_features: vec![],
1475 },
1476 output_type: parse_quote!(List<Raster<CPU>>),
1477 is_async: true,
1478 fields: vec![ParsedField {
1479 pat_ident: pat_ident("path"),
1480 name: None,
1481 description: String::new(),
1482 widget_override: ParsedWidgetOverride::None,
1483 ty: ParsedFieldType::Regular(RegularParsedField {
1484 ty: parse_quote!(String),
1485 exposed: true,
1486 value_source: ParsedValueSource::None,
1487 number_soft_min: None,
1488 number_soft_max: None,
1489 number_hard_min: None,
1490 number_hard_max: None,
1491 number_mode_range: false,
1492 implementations: Punctuated::new(),
1493 gpu_image: false,
1494 }),
1495 number_display_decimal_places: None,
1496 number_step: None,
1497 unit: None,
1498 is_data_field: false,
1499 }],

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