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

Function TestCoalesce

node/expr/binary/t_binary_op_test.go:392–460  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

390}
391
392func TestCoalesce(t *testing.T) {
393 src := `<? $a ?? $b;`
394
395 expected := &node.Root{
396 Position: &position.Position{
397 StartLine: 1,
398 EndLine: 1,
399 StartPos: 3,
400 EndPos: 12,
401 },
402 Stmts: []node.Node{
403 &stmt.Expression{
404 Position: &position.Position{
405 StartLine: 1,
406 EndLine: 1,
407 StartPos: 3,
408 EndPos: 12,
409 },
410 Expr: &binary.Coalesce{
411 Position: &position.Position{
412 StartLine: 1,
413 EndLine: 1,
414 StartPos: 3,
415 EndPos: 11,
416 },
417 Left: &expr.Variable{
418 Position: &position.Position{
419 StartLine: 1,
420 EndLine: 1,
421 StartPos: 3,
422 EndPos: 5,
423 },
424 VarName: &node.Identifier{
425 Position: &position.Position{
426 StartLine: 1,
427 EndLine: 1,
428 StartPos: 3,
429 EndPos: 5,
430 },
431 Value: "a",
432 },
433 },
434 Right: &expr.Variable{
435 Position: &position.Position{
436 StartLine: 1,
437 EndLine: 1,
438 StartPos: 9,
439 EndPos: 11,
440 },
441 VarName: &node.Identifier{
442 Position: &position.Position{
443 StartLine: 1,
444 EndLine: 1,
445 StartPos: 9,
446 EndPos: 11,
447 },
448 Value: "b",
449 },

Callers

nothing calls this directly

Calls 3

ParseMethod · 0.95
GetRootNodeMethod · 0.95
NewParserFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…