(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestBuildCondition(t *testing.T) { |
| 11 | conditionType, values, err := BuildCondition("text-contains", "done") |
| 12 | if err != nil { |
| 13 | t.Fatalf("BuildCondition() error = %v", err) |
| 14 | } |
| 15 | |
| 16 | if conditionType != "TEXT_CONTAINS" || |
| 17 | len(values) != 1 || |
| 18 | values[0].UserEnteredValue != "done" { |
| 19 | t.Fatalf("condition = %q, values = %#v", conditionType, values) |
| 20 | } |
| 21 | |
| 22 | conditionType, values, err = BuildCondition("blank", "") |
| 23 | if err != nil || conditionType != "BLANK" || values != nil { |
| 24 | t.Fatalf("blank condition = %q, values = %#v, error = %v", conditionType, values, err) |
| 25 | } |
| 26 | |
| 27 | for _, test := range []struct { |
| 28 | kind string |
| 29 | expression string |
| 30 | want string |
| 31 | }{ |
| 32 | {kind: "blank", expression: "x", want: "not used"}, |
| 33 | {kind: "text-eq", want: "required"}, |
| 34 | {kind: "unknown", want: "unsupported"}, |
| 35 | } { |
| 36 | if _, _, gotErr := BuildCondition(test.kind, test.expression); gotErr == nil || |
| 37 | !strings.Contains(gotErr.Error(), test.want) { |
| 38 | t.Fatalf("BuildCondition(%q) error = %v", test.kind, gotErr) |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | func TestBuildAddRequest(t *testing.T) { |
| 44 | gridRange := &sheets.GridRange{SheetId: 7, EndRowIndex: 4, EndColumnIndex: 2} |
nothing calls this directly
no test coverage detected