()
| 1624 | |
| 1625 | #[test] |
| 1626 | fn preserves_descriptions() { |
| 1627 | let php = r#"<?php |
| 1628 | class Foo { |
| 1629 | /** |
| 1630 | * Summary line. |
| 1631 | * |
| 1632 | * @param string $a The first param |
| 1633 | */ |
| 1634 | public function bar(string $a, int $b): void {} |
| 1635 | } |
| 1636 | "#; |
| 1637 | let pos = php.find("@param string").unwrap() as u32; |
| 1638 | let info = find_info(php, pos).unwrap(); |
| 1639 | let cl = no_class_loader(); |
| 1640 | let updated = build_updated_docblock( |
| 1641 | &info, |
| 1642 | php, |
| 1643 | &[], |
| 1644 | &cl, |
| 1645 | no_function_loader(), |
| 1646 | &HashMap::new(), |
| 1647 | &None, |
| 1648 | ); |
| 1649 | assert!( |
| 1650 | updated.contains("The first param"), |
| 1651 | "Should preserve description: {}", |
| 1652 | updated |
| 1653 | ); |
| 1654 | assert!( |
| 1655 | updated.contains("$b"), |
| 1656 | "Should add missing param: {}", |
| 1657 | updated |
| 1658 | ); |
| 1659 | assert!( |
| 1660 | updated.contains("Summary line"), |
| 1661 | "Should preserve summary: {}", |
| 1662 | updated |
| 1663 | ); |
| 1664 | } |
| 1665 | |
| 1666 | #[test] |
| 1667 | fn removes_extra_param_and_adds_missing() { |
nothing calls this directly
no test coverage detected