(t *testing.T)
| 439 | } |
| 440 | |
| 441 | func TestConstantParserTypeDetection(t *testing.T) { |
| 442 | tests := []struct { |
| 443 | name string |
| 444 | value string |
| 445 | expectedType phpType |
| 446 | }{ |
| 447 | {"string with double quotes", `"hello world"`, phpString}, |
| 448 | {"string with backticks", "`hello world`", phpString}, |
| 449 | {"boolean true", "true", phpBool}, |
| 450 | {"boolean false", "false", phpBool}, |
| 451 | {"integer", "42", phpInt}, |
| 452 | {"negative integer", "-42", phpInt}, |
| 453 | {"hex integer", "0xFF", phpInt}, |
| 454 | {"octal integer", "0755", phpInt}, |
| 455 | {"go octal integer", "0o755", phpInt}, |
| 456 | {"binary integer", "0b1010", phpInt}, |
| 457 | {"float", "3.14", phpFloat}, |
| 458 | {"negative float", "-3.14", phpFloat}, |
| 459 | {"scientific notation", "1e10", phpFloat}, |
| 460 | {"unknown type", "someFunction()", phpInt}, |
| 461 | } |
| 462 | |
| 463 | for _, tt := range tests { |
| 464 | t.Run(tt.name, func(t *testing.T) { |
| 465 | result := determineConstantType(tt.value) |
| 466 | assert.Equal(t, tt.expectedType, result, "determineConstantType(%s) expected %s", tt.value, tt.expectedType) |
| 467 | }) |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | func TestConstantParserClassConstants(t *testing.T) { |
| 472 | tests := []struct { |
nothing calls this directly
no test coverage detected