()
| 1533 | |
| 1534 | #[test] |
| 1535 | fn completions_bare_at_constant() { |
| 1536 | let content = concat!( |
| 1537 | "<?php\nclass Foo {\n", |
| 1538 | " /**\n", |
| 1539 | " * @\n", |
| 1540 | " */\n", |
| 1541 | " const X = 1;\n", |
| 1542 | "}\n", |
| 1543 | ); |
| 1544 | let pos = Position { |
| 1545 | line: 3, |
| 1546 | character: 8, |
| 1547 | }; |
| 1548 | let items = build_phpdoc_completions( |
| 1549 | content, |
| 1550 | "@", |
| 1551 | DocblockContext::Constant, |
| 1552 | pos, |
| 1553 | &std::collections::HashMap::new(), |
| 1554 | &None, |
| 1555 | &SmartContext::EMPTY, |
| 1556 | ); |
| 1557 | let filter_texts: Vec<&str> = items |
| 1558 | .iter() |
| 1559 | .filter_map(|i| i.filter_text.as_deref()) |
| 1560 | .collect(); |
| 1561 | |
| 1562 | assert!(filter_texts.contains(&"@var"), "Should suggest @var"); |
| 1563 | assert!( |
| 1564 | filter_texts.contains(&"@deprecated"), |
| 1565 | "Should suggest @deprecated" |
| 1566 | ); |
| 1567 | |
| 1568 | assert!( |
| 1569 | !filter_texts.contains(&"@param"), |
| 1570 | "Should NOT suggest @param in constant context" |
| 1571 | ); |
| 1572 | } |
| 1573 | |
| 1574 | #[test] |
| 1575 | fn completions_unknown_includes_all() { |
nothing calls this directly
no test coverage detected