mirror of
https://github.com/btcsuite/btcd.git
synced 2026-08-20 13:27:31 +02:00
version: preserve semantic version separators
In this commit, we include periods in the alphabet accepted by normalizeVerString. SemVer uses periods to separate pre-release identifiers, but the old filter silently collapsed beta.rc1 into betarc1. We add a focused test for the dotted RC suffix before using it for the next release candidate.
This commit is contained in:
parent
3d3b5e8a29
commit
65db49397a
2 changed files with 20 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ import (
|
|||
)
|
||||
|
||||
// semanticAlphabet
|
||||
const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-"
|
||||
const semanticAlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-."
|
||||
|
||||
// These constants define the application version and follow the semantic
|
||||
// versioning 2.0.0 spec (http://semver.org/).
|
||||
|
|
|
|||
19
version_test.go
Normal file
19
version_test.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) 2026 The btcsuite developers
|
||||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
|
||||
import "testing"
|
||||
|
||||
// TestNormalizeVerString ensures valid semantic version separators are
|
||||
// preserved when normalizing pre-release and build metadata strings.
|
||||
func TestNormalizeVerString(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
const version = "beta.rc1"
|
||||
if got := normalizeVerString(version); got != version {
|
||||
t.Fatalf("unexpected normalized version: got %q, want %q", got,
|
||||
version)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue