From 40fa13278d16c24793393d5c877451951b940720 Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Wed, 25 Aug 2021 08:11:02 +0200 Subject: [PATCH] xml input: add basic unit test case (#4894) --- .github/workflows/test.yml | 4 +- package.json | 6 +-- ...cl_abapgit_xml_input.clas.testclasses.abap | 42 +++++++++++++++---- 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 586e3884a..2854dba07 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: test -on: +on: push: pull_request: types: [opened] @@ -8,6 +8,7 @@ on: jobs: unit: runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 @@ -18,6 +19,7 @@ jobs: integration: needs: unit runs-on: ubuntu-latest + timeout-minutes: 5 steps: - uses: actions/checkout@v2 - uses: actions/setup-node@v2 diff --git a/package.json b/package.json index f550bcef6..0e7fcebcd 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "url": "git+https://github.com/abapGit/abapGit.git" }, "devDependencies": { - "@abaplint/cli": "^2.76.8", - "@abaplint/transpiler-cli": "^1.6.4", - "@abaplint/runtime": "^1.6.4", + "@abaplint/cli": "^2.76.13", + "@abaplint/transpiler-cli": "^1.6.10", + "@abaplint/runtime": "^1.6.10", "abapmerge": "^0.14.3", "eslint": "^7.32.0" } diff --git a/src/xml/zcl_abapgit_xml_input.clas.testclasses.abap b/src/xml/zcl_abapgit_xml_input.clas.testclasses.abap index 10b76eb63..136b914ea 100644 --- a/src/xml/zcl_abapgit_xml_input.clas.testclasses.abap +++ b/src/xml/zcl_abapgit_xml_input.clas.testclasses.abap @@ -2,12 +2,10 @@ CLASS ltcl_xml DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS. PUBLIC SECTION. METHODS: - up FOR TESTING - RAISING zcx_abapgit_exception, - empty FOR TESTING - RAISING zcx_abapgit_exception, - down FOR TESTING - RAISING zcx_abapgit_exception. + up FOR TESTING RAISING zcx_abapgit_exception, + empty FOR TESTING RAISING zcx_abapgit_exception, + input FOR TESTING RAISING zcx_abapgit_exception, + down FOR TESTING RAISING zcx_abapgit_exception. TYPES: BEGIN OF ty_old, foo TYPE i, @@ -25,6 +23,36 @@ ENDCLASS. CLASS ltcl_xml IMPLEMENTATION. + METHOD input. + + DATA lv_xml TYPE string. + DATA lo_input TYPE REF TO zcl_abapgit_xml_input. + DATA ls_data TYPE ty_old. + + lv_xml = |\n| && + |\n| && + | \n| && + | \n| && + | \n| && + | 2\n| && + | \n| && + | \n| && + | \n| && + ||. + + CREATE OBJECT lo_input + EXPORTING + iv_xml = lv_xml. + + lo_input->zif_abapgit_xml_input~read( EXPORTING iv_name = 'DATA' + CHANGING cg_data = ls_data ). + + cl_abap_unit_assert=>assert_equals( + act = ls_data-foo + exp = 2 ). + + ENDMETHOD. + METHOD empty. DATA: ls_old TYPE ty_old, @@ -124,4 +152,4 @@ CLASS ltcl_xml IMPLEMENTATION. ENDMETHOD. -ENDCLASS. +ENDCLASS. \ No newline at end of file