MCPcopy Create free account
hub / github.com/php/frankenphp / TestPHPConstantCValue

Function TestPHPConstantCValue

internal/extgen/constparser_test.go:669–746  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

667}
668
669func TestPHPConstantCValue(t *testing.T) {
670 tests := []struct {
671 name string
672 constant phpConstant
673 expected string
674 }{
675 {
676 name: "octal notation 0o35",
677 constant: phpConstant{
678 Name: "OctalConst",
679 Value: "0o35",
680 PhpType: phpInt,
681 },
682 expected: "29", // 0o35 = 29 in decimal
683 },
684 {
685 name: "octal notation 0o755",
686 constant: phpConstant{
687 Name: "OctalPerm",
688 Value: "0o755",
689 PhpType: phpInt,
690 },
691 expected: "493", // 0o755 = 493 in decimal
692 },
693 {
694 name: "regular integer",
695 constant: phpConstant{
696 Name: "RegularInt",
697 Value: "42",
698 PhpType: phpInt,
699 },
700 expected: "42",
701 },
702 {
703 name: "hex integer",
704 constant: phpConstant{
705 Name: "HexInt",
706 Value: "0xFF",
707 PhpType: phpInt,
708 },
709 expected: "0xFF", // hex should remain unchanged
710 },
711 {
712 name: "string constant",
713 constant: phpConstant{
714 Name: "StringConst",
715 Value: `"hello"`,
716 PhpType: phpString,
717 },
718 expected: `"hello"`, // strings should remain unchanged
719 },
720 {
721 name: "boolean constant",
722 constant: phpConstant{
723 Name: "BoolConst",
724 Value: "true",
725 PhpType: phpBool,
726 },

Callers

nothing calls this directly

Calls 1

CValueMethod · 0.80

Tested by

no test coverage detected