| 809 | |
| 810 | #[test] |
| 811 | fn test_full_roundtrip() { |
| 812 | let dir = tempfile::tempdir().unwrap(); |
| 813 | let hook = make_hook(); |
| 814 | |
| 815 | // Not installed initially |
| 816 | assert!(!hook.is_installed(dir.path())); |
| 817 | |
| 818 | // Install |
| 819 | let count = hook.install(dir.path()).unwrap(); |
| 820 | assert_eq!(count, 8); |
| 821 | assert!(hook.is_installed(dir.path())); |
| 822 | |
| 823 | // Idempotent install |
| 824 | let count2 = hook.install(dir.path()).unwrap(); |
| 825 | assert_eq!(count2, 0); |
| 826 | assert!(hook.is_installed(dir.path())); |
| 827 | |
| 828 | // Uninstall |
| 829 | hook.uninstall(dir.path()).unwrap(); |
| 830 | assert!(!hook.is_installed(dir.path())); |
| 831 | |
| 832 | // Reinstall |
| 833 | let count3 = hook.install(dir.path()).unwrap(); |
| 834 | assert_eq!(count3, 8); |
| 835 | assert!(hook.is_installed(dir.path())); |
| 836 | } |
| 837 | } |