summarylogtreecommitdiffstats
path: root/0003-git-ref-format-support-tests-with-debug_assertions.patch
blob: 61f4d31710a8551b9f8be19d3a891a0d42cf2011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
From ff04eb89835b2ab9237c06de36799f6c63db6ab9 Mon Sep 17 00:00:00 2001
From: Ivan Shapovalov <intelfx@intelfx.name>
Date: Fri, 16 Jan 2026 06:06:36 +0100
Subject: [PATCH 3/5] git-ref-format: support tests with !debug_assertions

---
 crates/radicle-git-ref-format/src/lib.rs | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/crates/radicle-git-ref-format/src/lib.rs b/crates/radicle-git-ref-format/src/lib.rs
index 5eb6eefb..0a7d491e 100644
--- a/crates/radicle-git-ref-format/src/lib.rs
+++ b/crates/radicle-git-ref-format/src/lib.rs
@@ -38,7 +38,7 @@ macro_rules! refname {
     ($arg:literal) => {{
         use $crate::RefString;
 
-        #[cfg(debug_assertions)]
+        #[cfg(any(debug_assertions, test))]
         {
             RefString::try_from($arg).expect(core::concat!(
                 "literal `",
@@ -47,7 +47,7 @@ macro_rules! refname {
             ))
         }
 
-        #[cfg(not(debug_assertions))]
+        #[cfg(not(any(debug_assertions, test)))]
         {
             extern crate alloc;
 
@@ -71,7 +71,7 @@ macro_rules! qualified {
     ($arg:literal) => {{
         use $crate::Qualified;
 
-        #[cfg(debug_assertions)]
+        #[cfg(any(debug_assertions, test))]
         {
             Qualified::from_refstr($crate::refname!($arg)).expect(core::concat!(
                 "literal `",
@@ -80,7 +80,7 @@ macro_rules! qualified {
             ))
         }
 
-        #[cfg(not(debug_assertions))]
+        #[cfg(not(any(debug_assertions, test)))]
         {
             extern crate alloc;
 
@@ -112,7 +112,7 @@ macro_rules! component {
     ($arg:literal) => {{
         use $crate::Component;
 
-        #[cfg(debug_assertions)]
+        #[cfg(any(debug_assertions, test))]
         {
             Component::from_refstr($crate::refname!($arg)).expect(core::concat!(
                 "literal `",
@@ -121,7 +121,7 @@ macro_rules! component {
             ))
         }
 
-        #[cfg(not(debug_assertions))]
+        #[cfg(not(any(debug_assertions, test)))]
         {
             extern crate alloc;
 
@@ -153,7 +153,7 @@ macro_rules! pattern {
     ($arg:literal) => {{
         use $crate::refspec::PatternString;
 
-        #[cfg(debug_assertions)]
+        #[cfg(any(debug_assertions, test))]
         {
             PatternString::try_from($arg).expect(core::concat!(
                 "literal `",
@@ -162,7 +162,7 @@ macro_rules! pattern {
             ))
         }
 
-        #[cfg(not(debug_assertions))]
+        #[cfg(not(any(debug_assertions, test)))]
         {
             extern crate alloc;
 
@@ -186,7 +186,7 @@ macro_rules! qualified_pattern {
     ($arg:literal) => {{
         use $crate::refspec::QualifiedPattern;
 
-        #[cfg(debug_assertions)]
+        #[cfg(any(debug_assertions, test))]
         {
             use core::concat;
 
@@ -205,7 +205,7 @@ macro_rules! qualified_pattern {
             ))
         }
 
-        #[cfg(not(debug_assertions))]
+        #[cfg(not(any(debug_assertions, test)))]
         {
             extern crate alloc;
 
-- 
2.53.0.8.g57fba0c4633