Skip to content

Commit 13498e5

Browse files
authored
fix: allow test discovery to handle oneliner unit-tests (#1134)
1 parent 4218313 commit 13498e5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
all: test
22

33
update-test-discovery:
4-
@perl -ne 'print if s/SENTRY_TEST\(([^)]+)\)/XX(\1)/' tests/unit/*.c | sort | grep -v define | uniq > tests/unit/tests.inc
4+
@perl -ne 'print if s/SENTRY_TEST\(([^)]+)\).*/XX(\1)/' tests/unit/*.c | sort | grep -v define | uniq > tests/unit/tests.inc
55
.PHONY: update-test-discovery
66

77
build/Makefile: CMakeLists.txt

scripts/update_test_discovery.ps1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1-
Get-ChildItem -Path 'tests/unit/*.c' | ForEach-Object {
1+
$lines = Get-ChildItem -Path 'tests/unit/*.c' | ForEach-Object {
22
Get-Content $_.FullName | ForEach-Object {
33
if ($_ -match 'SENTRY_TEST\(([^)]+)\)') {
4-
$_ -replace 'SENTRY_TEST\(([^)]+)\)', 'XX($1)'
4+
$_ -replace 'SENTRY_TEST\(([^)]+)\).*', 'XX($1)'
55
}
66
}
7-
} | Sort-Object | Where-Object { $_ -notmatch 'define' } | Get-Unique | Set-Content 'tests/unit/tests.inc'
7+
}
8+
9+
[System.Array]::Sort($lines, [System.StringComparer]::Ordinal)
10+
11+
$lines | Where-Object { $_ -notmatch 'define' } | Get-Unique | Set-Content 'tests/unit/tests.inc'

0 commit comments

Comments
 (0)