(t *testing.T)
| 4114 | } |
| 4115 | |
| 4116 | func TestOptionalMacroError(t *testing.T) { |
| 4117 | env := testEnv(t, |
| 4118 | OptionalTypes(), |
| 4119 | // Test variables. |
| 4120 | Variable("x", OptionalType(IntType)), |
| 4121 | ) |
| 4122 | _, iss := env.Compile("x.optMap(y.z, y.z + 1)") |
| 4123 | if iss.Err() == nil || !strings.Contains(iss.Err().Error(), "variable name must be a simple identifier") { |
| 4124 | t.Errorf("optMap() got an unexpected result: %v", iss.Err()) |
| 4125 | } |
| 4126 | _, iss = env.Compile("x.optFlatMap(y.z, y.z + 1)") |
| 4127 | if iss.Err() == nil || !strings.Contains(iss.Err().Error(), "variable name must be a simple identifier") { |
| 4128 | t.Errorf("optFlatMap() got an unexpected result: %v", iss.Err()) |
| 4129 | } |
| 4130 | env = testEnv(t, |
| 4131 | OptionalTypes(OptionalTypesVersion(0)), |
| 4132 | // Test variables. |
| 4133 | Variable("x", OptionalType(IntType)), |
| 4134 | ) |
| 4135 | _, iss = env.Compile("x.optFlatMap(y, y.z + 1)") |
| 4136 | if iss.Err() == nil || !strings.Contains(iss.Err().Error(), "undeclared reference to 'optFlatMap'") { |
| 4137 | t.Errorf("optFlatMap() got an unexpected result: %v", iss.Err()) |
| 4138 | } |
| 4139 | } |
| 4140 | |
| 4141 | // TestOptionalHasValueCost verifies that the cost of comparing the optional's value against the |
| 4142 | // input argument is tracked rather than being charged as a flat function call cost. |
nothing calls this directly
no test coverage detected