Skip to content

Commit 6ae8fa6

Browse files
test+fix: broaden Z-prefix regex, mark test class in abapGit metadata
* `emit-local-classes.test.ts` — broaden the Z-prefix guard to also catch solid identifiers (`ZFOO`, `ZAPI`, `ZCLIENT`) that the previous underscore-only regex missed. Strip banner/star/line-comment rows before matching so the doc header ("* ZERO Z-dependencies…") remains allowed while the body is strictly zero-Z. * `samples/petstore3-client/e2e/abapgit/src/zcl_ps3_client_tests.clas.xml` — add `<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>` to VSEOCLASS so the abapGit metadata matches the class body and ABAP Unit's discovery path does not rely purely on ABAP-level `FOR TESTING` semantics. Generated with [Devin](https://cli.devin.ai/docs) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
1 parent 19080c4 commit 6ae8fa6

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

packages/openai-codegen/tests/emit-local-classes.test.ts

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,27 @@ describe('emitLocalClasses — localsImp', () => {
8181
describe('emitLocalClasses — ZERO Z-dependencies', () => {
8282
it('does not reference any Z-prefixed symbol', () => {
8383
const { localsDef, localsImp } = emitLocalClasses(defaultNames);
84-
const zRef = /\b[zZ][a-zA-Z0-9_]*_[a-zA-Z0-9_]+/;
85-
// allow the header comment mention only; the generator keeps the
86-
// exception name out of the body entirely, so no Z-token at all.
87-
expect(localsDef).not.toMatch(zRef);
88-
expect(localsImp).not.toMatch(zRef);
84+
// Broad match: any token that starts with Z/z and is 3+ chars, either
85+
// underscore-containing (`ZCL_FOO`, `z_bar`) or solid (`ZFOO`, `zbar`).
86+
// The rationale the reviewer flagged is that solid names like `ZAPI`
87+
// or `ZCLIENT` should also be caught — restricting the match to
88+
// underscore-containing forms was too narrow.
89+
const zRef = /\b[Zz][A-Za-z0-9_]{2,}\b/;
90+
// The comment-stripped payload must contain zero Z-tokens so we are
91+
// truly dependency-free. The banner `* ZERO Z-dependencies` is only a
92+
// doc line at the top of the emitted source — strip comment-only lines
93+
// (`*` / `"` prefixes) before matching so the assertion checks the
94+
// actual code, not the banner.
95+
const stripComments = (src: string): string =>
96+
src
97+
.split('\n')
98+
.filter((l) => {
99+
const t = l.trimStart();
100+
return !t.startsWith('*') && !t.startsWith('"');
101+
})
102+
.join('\n');
103+
expect(stripComments(localsDef)).not.toMatch(zRef);
104+
expect(stripComments(localsImp)).not.toMatch(zRef);
89105
});
90106

91107
it('does not reference legacy or banned APIs', () => {

samples/petstore3-client/e2e/abapgit/src/zcl_ps3_client_tests.clas.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<CLSCCINCL>X</CLSCCINCL>
1111
<FIXPT>X</FIXPT>
1212
<UNICODE>X</UNICODE>
13+
<WITH_UNIT_TESTS>X</WITH_UNIT_TESTS>
1314
</VSEOCLASS>
1415
</asx:values>
1516
</asx:abap>

0 commit comments

Comments
 (0)