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

Function TestEscapeCString

internal/extgen/cfile_test.go:463–542  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

461}
462
463func TestEscapeCString(t *testing.T) {
464 tests := []struct {
465 name string
466 input string
467 expected string
468 }{
469 {
470 name: "simple namespace with single backslash",
471 input: `Go\Extension`,
472 expected: `Go\\Extension`,
473 },
474 {
475 name: "namespace with multiple backslashes",
476 input: `My\Deep\Namespace`,
477 expected: `My\\Deep\\Namespace`,
478 },
479 {
480 name: "complex nested namespace",
481 input: `TestIntegration\Extension\Module`,
482 expected: `TestIntegration\\Extension\\Module`,
483 },
484 {
485 name: "empty string",
486 input: "",
487 expected: "",
488 },
489 {
490 name: "single backslash",
491 input: `\`,
492 expected: `\\`,
493 },
494 {
495 name: "multiple consecutive backslashes",
496 input: `\\\`,
497 expected: `\\\\\\`,
498 },
499 {
500 name: "string without backslashes",
501 input: "TestNamespace",
502 expected: "TestNamespace",
503 },
504 {
505 name: "leading backslash",
506 input: `\Leading`,
507 expected: `\\Leading`,
508 },
509 {
510 name: "trailing backslash",
511 input: `Trailing\`,
512 expected: `Trailing\\`,
513 },
514 {
515 name: "mixed alphanumeric with backslashes",
516 input: `Path123\To456\File789`,
517 expected: `Path123\\To456\\File789`,
518 },
519 {
520 name: "unicode characters with backslashes",

Callers

nothing calls this directly

Calls 1

escapeCStringFunction · 0.85

Tested by

no test coverage detected