3 use std::panic::Location;
9 fn check_loc(&self, line: u32, col: u32) -> &Self {
10 let loc = Location::caller();
11 assert_eq!(loc.file(), file!(), "file mismatch");
12 assert_eq!(loc.line(), line, "line mismatch");
13 assert_eq!(loc.column(), col, "column mismatch");
19 // Tests that when `Location::caller` is used in a method chain,
20 // it points to the start of the correct call (the first character after the dot)
21 // instead of to the very first expression in the chain
24 check_loc(line!(), 9).check_loc(line!(), 31)
25 .check_loc(line!(), 10);