Skip to content

Commit ade1f47

Browse files
committed
Simplify hyperlink tests
- Remove trivial ProgressRecord test for setting hash/workDir fields - Simplify hyperlink rendering test to focus on actual hyperlink cases - Fix fragile assertion that checked for BEL character https://claude.ai/code/session_014AStcyMzd39iegXhfQL1yK Signed-off-by: Claude <noreply@anthropic.com>
1 parent 2bc4805 commit ade1f47

File tree

2 files changed

+16
-42
lines changed

2 files changed

+16
-42
lines changed

modules/nextflow/src/test/groovy/nextflow/trace/AnsiLogObserverTest.groovy

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -121,64 +121,51 @@ class AnsiLogObserverTest extends Specification {
121121
AnsiLogObserver.hyperlink('text', '') == 'text'
122122
}
123123

124-
@Unroll
125-
def 'should render a process line with workDir hyperlink' () {
126-
124+
def 'should render hash as hyperlink when workDir is set' () {
127125
given:
128126
def session = Mock(Session) { getConfig() >> [cleanup: false] }
129127
def observer = new AnsiLogObserver()
130128
observer.@session = session
129+
observer.@labelWidth = 3
130+
observer.@cols = 190
131+
and:
131132
def stats = new ProgressRecord(1, 'foo')
132-
stats.submitted = SUBMIT
133-
stats.succeeded = SUCCEEDED
134-
stats.hash = HASH
133+
stats.submitted = 1
134+
stats.hash = '4e/486876'
135135
stats.workDir = WORKDIR
136136

137137
when:
138-
observer.@labelWidth = stats.name.size()
139-
observer.@cols = 190
138+
def result = observer.line(stats).toString()
140139

141140
then:
142-
// Strip ANSI color codes but preserve OSC 8 hyperlink sequences
143-
def result = observer.line(stats).toString()
144-
def strippedColors = result.replaceAll('\u001B\\[[\\d;]*[^\\d;]','')
145-
strippedColors.contains(HASH_DISPLAY)
146-
// Check hyperlink is present when workDir is set
147-
if( WORKDIR ) {
148-
assert result.contains('\033]8;;' + EXPECTED_HREF + '\007')
149-
assert result.contains('\033]8;;\007')
150-
}
141+
result.contains('\033]8;;' + EXPECTED_HREF + '\007')
142+
result.contains('\033]8;;\007')
151143

152144
where:
153-
HASH | WORKDIR | SUBMIT | SUCCEEDED | HASH_DISPLAY | EXPECTED_HREF
154-
'4e/486876' | '/work/4e/486876abc' | 1 | 0 | '4e/486876' | 'file:///work/4e/486876abc'
155-
'4e/486876' | 's3://bucket/work/4e/486876abc' | 0 | 1 | '4e/486876' | 's3://bucket/work/4e/486876abc'
156-
'4e/486876' | null | 1 | 0 | '4e/486876' | null
157-
null | null | 0 | 0 | '-' | null
145+
WORKDIR | EXPECTED_HREF
146+
'/work/4e/486876abc' | 'file:///work/4e/486876abc'
147+
's3://bucket/work/4e/486876abc' | 's3://bucket/work/4e/486876abc'
158148
}
159149

160150
def 'should not render hyperlink when cleanup is enabled' () {
161-
162151
given:
163152
def session = Mock(Session) { getConfig() >> [cleanup: true] }
164153
def observer = new AnsiLogObserver()
165154
observer.@session = session
155+
observer.@labelWidth = 3
156+
observer.@cols = 190
157+
and:
166158
def stats = new ProgressRecord(1, 'foo')
167159
stats.submitted = 1
168160
stats.hash = '4e/486876'
169161
stats.workDir = '/work/4e/486876abc'
170162

171163
when:
172-
observer.@labelWidth = stats.name.size()
173-
observer.@cols = 190
174164
def result = observer.line(stats).toString()
175165

176166
then:
177-
// Should NOT contain hyperlink escape sequences
167+
// Should NOT contain hyperlink start sequence
178168
!result.contains('\033]8;;')
179-
!result.contains('\007')
180-
// But should still contain the hash
181-
result.replaceAll('\u001B\\[[\\d;]*[^\\d;]','').contains('4e/486876')
182169
}
183170

184171
}

modules/nextflow/src/test/groovy/nextflow/trace/ProgressRecordTest.groovy

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,6 @@ class ProgressRecordTest extends Specification {
5353
}
5454
}
5555

56-
def 'should set hash and workDir' () {
57-
given:
58-
def rec = new ProgressRecord(10, 'foo')
59-
60-
when:
61-
rec.hash = '4e/486876'
62-
rec.workDir = 'file:///work/4e/486876abc'
63-
64-
then:
65-
rec.hash == '4e/486876'
66-
rec.workDir == 'file:///work/4e/486876abc'
67-
}
68-
6956
def 'should get counts' () {
7057
given:
7158
def PENDING = 1

0 commit comments

Comments
 (0)