We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 25bd121 commit 1b3c957Copy full SHA for 1b3c957
test/unit/remap_path_prefix/BUILD.bazel
@@ -0,0 +1,14 @@
1
+load("//rust:defs.bzl", "rust_test", "rust_library")
2
+
3
+rust_library(
4
+ name = "dep",
5
+ srcs = ["dep.rs"],
6
+ edition = "2018",
7
+)
8
9
+rust_test(
10
+ name = "remap_path_prefix",
11
+ srcs = ["test.rs"],
12
13
+ deps = [":dep"],
14
test/unit/remap_path_prefix/dep.rs
@@ -0,0 +1,4 @@
+// Without --remap-path-prefix, Location::caller() in this generic function will return an absolute path
+pub fn get_file_name<T>() -> &'static str {
+ std::panic::Location::caller().file()
+}
test/unit/remap_path_prefix/test.rs
+#[test]
+fn test_dep_file_name() {
+ assert_eq!(dep::get_file_name::<()>(), "test/unit/remap_path_prefix/dep.rs");
0 commit comments