company facts simple read out of xls works

This commit is contained in:
Andreas Schröpfer
2021-02-28 08:33:00 +01:00
parent e0faa1fc7c
commit 90af0db862
11 changed files with 197 additions and 170 deletions

View File

@@ -6,6 +6,7 @@ func TestField(t *testing.T) {
input := struct {
MyString string
MyInt int
MyFloat float64
MyBool bool
}{}
value := "abc"
@@ -13,15 +14,21 @@ func TestField(t *testing.T) {
if input.MyString != value {
t.Errorf("got: %s; want: %s", input.MyString, value)
}
vInt := 2
Field(&input, "MyInt", vInt)
if input.MyInt != vInt {
t.Errorf("MyInt: %d, want: %d", input.MyInt, vInt)
err := Field(&input, "MyFloat", "3.14")
if err != nil {
t.Error("expect no error, when can be converted")
}
err := Field(&input, "MyInt", "vInt")
if input.MyFloat != 3.14 {
t.Errorf("MyFloat is not 3.14. Got: %#v", input.MyFloat)
}
err = Field(&input, "MyInt", "vInt")
if err == nil {
t.Error("expect error, when wrong value-Type")
}
err = Field(&input, "MyInt", "3")
if err != nil {
t.Error("expect no error, when can be converted")
}
err = Field(&input, "NoField", "jjj")
if err == nil {
t.Error("expect error, when field not exists")