feat(app): add semantic Version constant 0.1.0

Add exported constant app.Version in major.minor.patch format (0.1.0) with
documentation of the manual increment process (when to bump patch/minor/major).
Include the version in the /help command reply and add tests verifying the
semver format and the version presence in help text.
This commit is contained in:
ki.sagidullin
2026-08-17 15:58:14 +05:00
parent bdd9b41e56
commit d41c0d172f
2 changed files with 57 additions and 18 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"os"
"path/filepath"
"regexp"
"strings"
"testing"
)
@@ -216,17 +217,31 @@ func TestHelp_IsBinaryCommand(t *testing.T) {
}
}
// TestHelpText_ContainsCommands проверяет, что справка упоминает все команды.
// TestHelpText_ContainsCommands проверяет, что справка упоминает все команды
// и номер версии приложения.
func TestHelpText_ContainsCommands(t *testing.T) {
text := helpTextFor(Version)
for _, cmd := range []string{
"/start", "/cancel", "/skip", "/retry", "/status", "/continue",
"/update", "/help",
} {
if !strings.Contains(helpText, cmd) {
if !strings.Contains(text, cmd) {
t.Errorf("helpText не упоминает команду %s", cmd)
}
}
if !strings.Contains(helpText, "Ratatoskr") {
if !strings.Contains(text, "Ratatoskr") {
t.Errorf("helpText не содержит имени бота")
}
if !strings.Contains(text, Version) {
t.Errorf("helpText не содержит номера версии приложения %s", Version)
}
}
// TestVersion_Semver проверяет, что константа версии приложения объявлена
// в формате major.minor.patch (например 0.1.0).
func TestVersion_Semver(t *testing.T) {
re := regexp.MustCompile(`^\d+\.\d+\.\d+$`)
if !re.MatchString(Version) {
t.Errorf("Version = %q, ожидался формат major.minor.patch", Version)
}
}