(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestTupleStatic(t *testing.T) { |
| 57 | expr, diags := ParseExpression([]byte(`[true, false]`), "", hcl.Pos{Line: 1, Column: 1}) |
| 58 | exprs, moreDiags := hcl.ExprList(expr) |
| 59 | diags = append(diags, moreDiags...) |
| 60 | if len(diags) != 0 { |
| 61 | t.Errorf("wrong number of diags %d; want 0", len(diags)) |
| 62 | for _, diag := range diags { |
| 63 | t.Logf("- %s", diag) |
| 64 | } |
| 65 | return |
| 66 | } |
| 67 | |
| 68 | if got, want := len(exprs), 2; got != want { |
| 69 | t.Fatalf("wrong length %d; want %d", got, want) |
| 70 | } |
| 71 | |
| 72 | got := make([]cty.Value, len(exprs)) |
| 73 | want := []cty.Value{ |
| 74 | cty.True, |
| 75 | cty.False, |
| 76 | } |
| 77 | for i, itemExpr := range exprs { |
| 78 | val, valDiags := itemExpr.Value(nil) |
| 79 | if len(valDiags) != 0 { |
| 80 | t.Errorf("wrong number of diags %d; want 0", len(valDiags)) |
| 81 | for _, diag := range valDiags { |
| 82 | t.Logf("- %s", diag) |
| 83 | } |
| 84 | return |
| 85 | } |
| 86 | got[i] = val |
| 87 | } |
| 88 | |
| 89 | for _, problem := range deep.Equal(got, want) { |
| 90 | t.Error(problem) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | func TestMapStatic(t *testing.T) { |
| 95 | expr, diags := ParseExpression([]byte(`{"foo":true,"bar":false}`), "", hcl.Pos{Line: 1, Column: 1}) |
nothing calls this directly
no test coverage detected