(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestGetNamespacedFunctionName(t *testing.T) { |
| 57 | tests := []struct { |
| 58 | name string |
| 59 | namespace string |
| 60 | functionName string |
| 61 | expected string |
| 62 | }{ |
| 63 | { |
| 64 | name: "no namespace", |
| 65 | namespace: "", |
| 66 | functionName: "test_func", |
| 67 | expected: "test_func", |
| 68 | }, |
| 69 | { |
| 70 | name: "single level namespace", |
| 71 | namespace: "MyNamespace", |
| 72 | functionName: "test_func", |
| 73 | expected: "MyNamespace_test_func", |
| 74 | }, |
| 75 | { |
| 76 | name: "multi level namespace", |
| 77 | namespace: `Go\Extension`, |
| 78 | functionName: "multiply", |
| 79 | expected: "Go_Extension_multiply", |
| 80 | }, |
| 81 | } |
| 82 | |
| 83 | for _, tt := range tests { |
| 84 | t.Run(tt.name, func(t *testing.T) { |
| 85 | result := NamespacedName(tt.namespace, tt.functionName) |
| 86 | |
| 87 | require.Equal(t, tt.expected, result, "Expected %q, got %q", tt.expected, result) |
| 88 | }) |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | func TestCFileWithNamespacedPHPFunctions(t *testing.T) { |
| 93 | generator := &Generator{ |
nothing calls this directly
no test coverage detected