supports binary-format, only esp* supported for now

This commit is contained in:
Li Jie
2025-08-22 20:42:43 +08:00
parent 1f193c8533
commit ecaf7c8ac6
10 changed files with 568 additions and 15 deletions

View File

@@ -0,0 +1,28 @@
package firmware
import "testing"
func TestBinaryExt(t *testing.T) {
tests := []struct {
name string
binaryFormat string
expected string
}{
{"ESP32", "esp32", ".bin"},
{"ESP8266", "esp8266", ".bin"},
{"ESP32C3", "esp32c3", ".bin"},
{"UF2", "uf2", ""},
{"ELF", "elf", ""},
{"Empty", "", ""},
{"NRF-DFU", "nrf-dfu", ""},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
result := BinaryExt(tt.binaryFormat)
if result != tt.expected {
t.Errorf("BinaryExt() = %q, want %q", result, tt.expected)
}
})
}
}