(new): expand runtime APIs
(fix): harden concurrent lifecycle (tests): add regression coverage (doc): update v1.2 guidance
This commit is contained in:
@@ -46,6 +46,21 @@ func TestBotOptsFileJSONCodecRoundTrip(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBotOptsFileRejectsNilInputs(t *testing.T) {
|
||||
if _, err := (BotOptsFileJSONCodec{}).ToBytes(nil); !errors.Is(err, ErrOptsIsNil) {
|
||||
t.Fatalf("ToBytes error = %v, want ErrOptsIsNil", err)
|
||||
}
|
||||
if _, err := LoadBotOptsFile(nil, "unused"); !errors.Is(err, ErrCodecIsNil) {
|
||||
t.Fatalf("LoadBotOptsFile error = %v, want ErrCodecIsNil", err)
|
||||
}
|
||||
if err := SaveBotOptsFile(nil, "unused", &BotOpts{}); !errors.Is(err, ErrCodecIsNil) {
|
||||
t.Fatalf("SaveBotOptsFile error = %v, want ErrCodecIsNil", err)
|
||||
}
|
||||
if err := SaveBotOptsFile(BotOptsFileJSONCodec{}, "unused", nil); !errors.Is(err, ErrOptsIsNil) {
|
||||
t.Fatalf("SaveBotOptsFile nil opts error = %v, want ErrOptsIsNil", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadBotOptsFileExpandsEnvPlaceholders(t *testing.T) {
|
||||
t.Setenv("TG_TOKEN", "TOKEN_FROM_ENV")
|
||||
t.Setenv("BOT_API_URL", "https://api.example.invalid")
|
||||
|
||||
Reference in New Issue
Block a user