(t *testing.T)
| 168 | } |
| 169 | |
| 170 | func TestGoReflectCustomIntValueOf(t *testing.T) { |
| 171 | const SCRIPT = ` |
| 172 | if (i instanceof Number) { |
| 173 | i.valueOf(); |
| 174 | } else { |
| 175 | throw new Error("Value is not a number"); |
| 176 | } |
| 177 | ` |
| 178 | |
| 179 | type CustomInt int |
| 180 | var i CustomInt = 42 |
| 181 | |
| 182 | r := New() |
| 183 | r.Set("i", i) |
| 184 | v, err := r.RunString(SCRIPT) |
| 185 | if err != nil { |
| 186 | t.Fatal(err) |
| 187 | } |
| 188 | |
| 189 | if !v.StrictEquals(intToValue(42)) { |
| 190 | t.Fatalf("Expected int 42, got %v", v) |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | func TestGoReflectEqual(t *testing.T) { |
| 195 | const SCRIPT = ` |
nothing calls this directly
no test coverage detected
searching dependent graphs…