feat(plugin): parse admin API compatibility
This commit is contained in:
parent
742f4434b1
commit
f6e09fde4b
@ -57,6 +57,7 @@ type ModPlugin struct {
|
||||
|
||||
type ModCompat struct {
|
||||
BlockCore string `toml:"block_core"`
|
||||
AdminAPI string `toml:"admin_api"`
|
||||
}
|
||||
|
||||
type ModRequirement struct {
|
||||
|
||||
@ -278,6 +278,7 @@ version = "0.2.0"
|
||||
|
||||
[compatibility]
|
||||
block_core = ">=1.5 <2.0"
|
||||
admin_api = ">=0.1.2 <0.2.0"
|
||||
|
||||
[[requires]]
|
||||
name = "@blockninja/smartblock"
|
||||
@ -291,8 +292,14 @@ version = ">=1.2"
|
||||
if err != nil {
|
||||
t.Fatalf("ParseModFull err: %v", err)
|
||||
}
|
||||
if m.Compatibility == nil || m.Compatibility.BlockCore != ">=1.5 <2.0" {
|
||||
t.Errorf("Compat = %+v", m.Compatibility)
|
||||
if m.Compatibility == nil {
|
||||
t.Fatal("Compatibility is nil")
|
||||
}
|
||||
if m.Compatibility.BlockCore != ">=1.5 <2.0" {
|
||||
t.Errorf("Compat.BlockCore = %q", m.Compatibility.BlockCore)
|
||||
}
|
||||
if m.Compatibility.AdminAPI != ">=0.1.2 <0.2.0" {
|
||||
t.Errorf("Compat.AdminAPI = %q", m.Compatibility.AdminAPI)
|
||||
}
|
||||
if len(m.Requires) != 2 {
|
||||
t.Fatalf("Requires len = %d, want 2", len(m.Requires))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user