From edab8f2fd48efddc19eb0032955fee4b5dbf76e6 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Thu, 23 Mar 2023 16:00:59 -0600 Subject: [PATCH] fix(core): located_script_name macro was using format syntax (#18388) --- core/lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/core/lib.rs b/core/lib.rs index ba0a026bc0..3f4cdd2e00 100644 --- a/core/lib.rs +++ b/core/lib.rs @@ -145,7 +145,15 @@ pub mod _ops { #[macro_export] macro_rules! located_script_name { () => { - concat!("[ext:{}:{}:{}]", std::file!(), std::line!(), std::column!()); + concat!( + "[ext:", + std::file!(), + ":", + std::line!(), + ":", + std::column!(), + "]" + ) }; } @@ -153,6 +161,13 @@ macro_rules! located_script_name { mod tests { use super::*; + #[test] + fn located_script_name() { + // Note that this test will fail if this file is moved. We don't + // test line locations because that's just too brittle. + assert!(located_script_name!().starts_with("[ext:core/lib.rs:")); + } + #[test] fn test_v8_version() { assert!(v8_version().len() > 3);