A file-based task manager
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix failing test

+30 -18
+1 -1
src/lib.rs
··· 262 262 263 263 #[derive(Subcommand)] 264 264 enum PropAction { 265 - /// List all values for every property on a task. 265 + /// List property keys set on a task. 266 266 List { 267 267 #[command(flatten)] 268 268 task_id: TaskId,
+29 -17
tests/multi_user.rs
··· 178 178 tsk_ok(&alice, &["prop", "add", "-T", "tsk-1", "tag", "beta"]); 179 179 tsk_ok(&alice, &["prop", "add", "-T", "tsk-2", "priority", "low"]); 180 180 181 - // List on tsk-1: priority=high, tag=alpha, tag=beta. 181 + // `prop list` lists keys set on the task; use `show -x` for values. 182 182 let list = tsk_ok(&alice, &["prop", "list", "-T", "tsk-1"]); 183 - assert!(list.contains("priority\thigh"), "got {list}"); 184 - assert!(list.contains("tag\talpha"), "got {list}"); 185 - assert!(list.contains("tag\tbeta"), "got {list}"); 183 + assert!(list.lines().any(|line| line == "priority"), "got {list}"); 184 + assert!(list.lines().any(|line| line == "tag"), "got {list}"); 185 + assert!(!list.contains('\t'), "prop list should only print keys: {list}"); 186 + let attrs = tsk_ok(&alice, &["show", "-T", "tsk-1", "-x"]); 187 + assert!(attrs.contains("priority: \"high\""), "got {attrs}"); 188 + assert!(attrs.contains("tag: \"alpha\""), "got {attrs}"); 189 + assert!(attrs.contains("tag: \"beta\""), "got {attrs}"); 186 190 187 191 // Keys index has both `priority` and `tag`. 188 192 let keys = tsk_ok(&alice, &["prop", "keys"]); ··· 196 200 197 201 // Unsetting one value on multi-value property. 198 202 tsk_ok(&alice, &["prop", "unset", "-T", "tsk-1", "tag", "alpha"]); 199 - let list = tsk_ok(&alice, &["prop", "list", "-T", "tsk-1"]); 200 - assert!(!list.contains("tag\talpha"), "alpha should be gone: {list}"); 201 - assert!(list.contains("tag\tbeta"), "beta survives: {list}"); 203 + let attrs = tsk_ok(&alice, &["show", "-T", "tsk-1", "-x"]); 204 + assert!( 205 + !attrs.contains("tag: \"alpha\""), 206 + "alpha should be gone: {attrs}" 207 + ); 208 + assert!(attrs.contains("tag: \"beta\""), "beta survives: {attrs}"); 202 209 203 210 // Replace whole property. 204 211 tsk_ok( 205 212 &alice, 206 213 &["prop", "set", "-T", "tsk-1", "priority", "medium"], 207 214 ); 208 - let list = tsk_ok(&alice, &["prop", "list", "-T", "tsk-1"]); 209 - assert!(list.contains("priority\tmedium"), "got {list}"); 210 - assert!(!list.contains("priority\thigh"), "got {list}"); 215 + let attrs = tsk_ok(&alice, &["show", "-T", "tsk-1", "-x"]); 216 + assert!(attrs.contains("priority: \"medium\""), "got {attrs}"); 217 + assert!(!attrs.contains("priority: \"high\""), "got {attrs}"); 211 218 } 212 219 213 220 #[test] ··· 294 301 295 302 // After the merge pull, Bob should see both his and Alice's edits on 296 303 // the task. 297 - let listing = tsk_ok(&bob, &["prop", "list", "-T", "tsk-1"]); 298 - eprintln!("LISTING: {listing}"); 304 + let listing = tsk_ok(&bob, &["show", "-T", "tsk-1", "-x"]); 299 305 assert!( 300 - listing.contains("priority\thigh"), 306 + listing.contains("priority: \"high\""), 301 307 "alice's edit lost: {listing}" 302 308 ); 303 - assert!(listing.contains("owner\tbob"), "bob's edit lost: {listing}"); 309 + assert!( 310 + listing.contains("owner: \"bob\""), 311 + "bob's edit lost: {listing}" 312 + ); 304 313 } 305 314 306 315 #[test] ··· 322 331 ); 323 332 324 333 // Both edits survived. 325 - let listing = tsk_ok(&bob, &["prop", "list", "-T", "tsk-1"]); 334 + let listing = tsk_ok(&bob, &["show", "-T", "tsk-1", "-x"]); 326 335 assert!( 327 - listing.contains("priority\thigh"), 336 + listing.contains("priority: \"high\""), 328 337 "alice's edit lost: {listing}" 329 338 ); 330 - assert!(listing.contains("owner\tbob"), "bob's edit lost: {listing}"); 339 + assert!( 340 + listing.contains("owner: \"bob\""), 341 + "bob's edit lost: {listing}" 342 + ); 331 343 } 332 344 333 345 #[test]