(&self, all: bool)
| 94 | } |
| 95 | |
| 96 | fn record(&self, all: bool) -> Change { |
| 97 | self.atomic(&[ |
| 98 | "record", |
| 99 | if all { "-am" } else { "-m" }, |
| 100 | "rename", |
| 101 | "--author", |
| 102 | "Rename Test", |
| 103 | ]); |
| 104 | let repo = Repository::open(self.root.path()).unwrap(); |
| 105 | let history = repo.log(HistoryOptions::default()).unwrap(); |
| 106 | let latest = history.iter().max_by_key(|entry| entry.sequence).unwrap(); |
| 107 | let change = repo.load_change(&latest.hash).unwrap(); |
| 108 | assert_eq!( |
| 109 | change |
| 110 | .hunks() |
| 111 | .iter() |
| 112 | .filter(|op| matches!(op, GraphOp::FileMove { path, .. } if path == "new.txt")) |
| 113 | .count(), |
| 114 | 1 |
| 115 | ); |
| 116 | assert!(!change |
| 117 | .hunks() |
| 118 | .iter() |
| 119 | .any(|op| matches!(op, GraphOp::FileAdd { .. } | GraphOp::FileDel { .. }))); |
| 120 | assert!(change.file_ops().iter().any(|ops| matches!(ops.trunk_op(), Some(TrunkOp::Move { trunk, .. }) if *trunk == self.trunk))); |
| 121 | self.assert_identity(&repo); |
| 122 | change |
| 123 | } |
| 124 | |
| 125 | fn assert_identity(&self, repo: &Repository) { |
| 126 | assert_eq!(repo.get_file_inode("new.txt").unwrap(), Some(self.inode)); |
no test coverage detected