MCPcopy Create free account
hub / github.com/z7zmey/php-parser / TestBinaryString

Function TestBinaryString

node/expr/cast/t_cast_test.go:539–595  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

537}
538
539func TestBinaryString(t *testing.T) {
540 src := `<? (binary)$a;`
541
542 expected := &node.Root{
543 Position: &position.Position{
544 StartLine: 1,
545 EndLine: 1,
546 StartPos: 3,
547 EndPos: 14,
548 },
549 Stmts: []node.Node{
550 &stmt.Expression{
551 Position: &position.Position{
552 StartLine: 1,
553 EndLine: 1,
554 StartPos: 3,
555 EndPos: 14,
556 },
557 Expr: &cast.String{
558 Position: &position.Position{
559 StartLine: 1,
560 EndLine: 1,
561 StartPos: 3,
562 EndPos: 13,
563 },
564 Expr: &expr.Variable{
565 Position: &position.Position{
566 StartLine: 1,
567 EndLine: 1,
568 StartPos: 11,
569 EndPos: 13,
570 },
571 VarName: &node.Identifier{
572 Position: &position.Position{
573 StartLine: 1,
574 EndLine: 1,
575 StartPos: 11,
576 EndPos: 13,
577 },
578 Value: "a",
579 },
580 },
581 },
582 },
583 },
584 }
585
586 php7parser := php7.NewParser([]byte(src), "7.4")
587 php7parser.Parse()
588 actual := php7parser.GetRootNode()
589 assert.DeepEqual(t, expected, actual)
590
591 php5parser := php5.NewParser([]byte(src), "5.6")
592 php5parser.Parse()
593 actual = php5parser.GetRootNode()
594 assert.DeepEqual(t, expected, actual)
595}
596

Callers

nothing calls this directly

Calls 4

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…