better output when unit test fails for structures (#139)

This commit is contained in:
Lars Hvam
2022-09-23 08:49:28 +02:00
committed by GitHub
parent c37fc7451f
commit 2937f9b972
5 changed files with 37 additions and 1 deletions

View File

@@ -108,7 +108,7 @@ class Runner {
fs.writeFileSync(path.join(this.tmpDir, "abap_transpile.json"), JSON.stringify(config, null, 2));
execSync(`cp ${inputDir}/*.abap ${this.tmpDir}`, {stdio: 'pipe'});
fs.mkdirSync(`${this.tmpDir}/deps`);
execSync(`cp open-abap/src/unit/*.clas.abap ${this.tmpDir}/deps/`, {stdio: 'pipe'});
execSync(`cp open-abap/src/unit/*.clas*.abap ${this.tmpDir}/deps/`, {stdio: 'pipe'});
execSync(`cp open-abap/src/exceptions/* ${this.tmpDir}/deps/`, {stdio: 'pipe'});
execSync(`cp open-abap/src/cl_abap_char_utilities.clas.abap ${this.tmpDir}/deps/`, {stdio: 'pipe'});
execSync(`cp open-abap/src/cl_message_helper.clas.abap ${this.tmpDir}/deps/`, {stdio: 'pipe'});

View File

@@ -76,4 +76,8 @@ describe('abap-test-runner', async () => {
it('no-chained-assignment', async () => {
test("no-chained-assignment", "error");
});
it('structure-fail', async () => {
test("structure-fail", "fail");
});
});

View File

@@ -0,0 +1 @@
{"version":2,"status":"fail","tests":[{"name":"TEST","status":"fail","message":"Expected 'field: 2', got 'field: 1'"}]}

View File

@@ -0,0 +1,8 @@
CLASS zcl_simple DEFINITION PUBLIC.
PUBLIC SECTION.
ENDCLASS.
CLASS zcl_simple IMPLEMENTATION.
ENDCLASS.

View File

@@ -0,0 +1,23 @@
CLASS ltcl_simple DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
PRIVATE SECTION.
METHODS test FOR TESTING RAISING cx_static_check.
ENDCLASS.
CLASS ltcl_simple IMPLEMENTATION.
METHOD test.
TYPES: BEGIN OF ty,
field TYPE i,
END OF ty.
DATA data1 TYPE ty.
DATA data2 TYPE ty.
data1-field = 1.
data2-field = 2.
cl_abap_unit_assert=>assert_equals(
act = data1
exp = data2 ).
ENDMETHOD.
ENDCLASS.