Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 3x 3x 3x 3x 3x 3x 3x 3x 1x 3x 3x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 1x 1x 1x 1x | const {zcl_abapgit_git_delta} = await import("./zcl_abapgit_git_delta.clas.mjs"); const {lcl_stream} = await import("./zcl_abapgit_git_delta.clas.locals.mjs"); await import("./zcl_abapgit_git_delta.clas.locals.mjs"); const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_git_delta.clas.testclasses.abap class ltcl_git_delta_test { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_GIT_DELTA-LTCL_GIT_DELTA_TEST'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {}; static METHODS = {"TEST_DECODE_DELTAS_EMPTY": {"visibility": "I", "parameters": {}}, "TEST_DECODE_DELTAS_NO_DELTA": {"visibility": "I", "parameters": {}}, "TEST_DECODE_DELTAS_SUCCESS": {"visibility": "I", "parameters": {}}}; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "test_decode_deltas_empty": this.#test_decode_deltas_empty.bind(this), "test_decode_deltas_no_delta": this.#test_decode_deltas_no_delta.bind(this), "test_decode_deltas_success": this.#test_decode_deltas_success.bind(this), }; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async #test_decode_deltas_empty() { let lt_objects = abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}), "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}), "adler32": new abap.types.Hex({length: 4}), "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"sha","type":"SORTED","isUnique":false,"keyFields":["SHA1"]},{"name":"type","type":"SORTED","isUnique":false,"keyFields":["TYPE","SHA1"]}]}, "zif_abapgit_definitions=>ty_objects_tt"); await abap.Classes['ZCL_ABAPGIT_GIT_DELTA'].decode_deltas({iv_show_progress: abap.builtin.abap_false, ct_objects: lt_objects}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: lt_objects}), exp: abap.IntegerFactory.get(0), msg: abap.CharacterFactory.get(38, 'Empty object table should remain empty')}); } async #test_decode_deltas_no_delta() { let lt_objects = abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}), "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}), "adler32": new abap.types.Hex({length: 4}), "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"sha","type":"SORTED","isUnique":false,"keyFields":["SHA1"]},{"name":"type","type":"SORTED","isUnique":false,"keyFields":["TYPE","SHA1"]}]}, "zif_abapgit_definitions=>ty_objects_tt"); let ls_object = new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}), "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}), "adler32": new abap.types.Hex({length: 4}), "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}); ls_object.get().sha1.set(abap.CharacterFactory.get(40, '1234567890123456789012345678901234567890')); ls_object.get().type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_type.get().blob); ls_object.get().data.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring_utf8({iv_string: new abap.types.String().set(`Hello World`)}))); ls_object.get().index.set(abap.IntegerFactory.get(1)); abap.statements.append({source: ls_object, target: lt_objects}); await abap.Classes['ZCL_ABAPGIT_GIT_DELTA'].decode_deltas({iv_show_progress: abap.builtin.abap_false, ct_objects: lt_objects}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: lt_objects}), exp: abap.IntegerFactory.get(1), msg: abap.CharacterFactory.get(41, 'Non-delta objects should remain unchanged')}); abap.statements.readTable(lt_objects,{index: abap.IntegerFactory.get(1), into: ls_object}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: ls_object.get().type, exp: abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_type.get().blob, msg: abap.CharacterFactory.get(30, 'Object type should remain blob')}); } async #test_decode_deltas_success() { let lt_objects = abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}), "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}), "adler32": new abap.types.Hex({length: 4}), "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"sha","type":"SORTED","isUnique":false,"keyFields":["SHA1"]},{"name":"type","type":"SORTED","isUnique":false,"keyFields":["TYPE","SHA1"]}]}, "zif_abapgit_definitions=>ty_objects_tt"); let lv_original_count = new abap.types.Integer({qualifiedName: "I"}); let ls_object = new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "type": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_type"}), "data": new abap.types.XString({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-DATA"}), "adler32": new abap.types.Hex({length: 4}), "index": new abap.types.Integer({qualifiedName: "ZIF_ABAPGIT_DEFINITIONS=>TY_OBJECT-INDEX"})}, "zif_abapgit_definitions=>ty_object", undefined, {}, {}); ls_object.get().sha1.set(abap.CharacterFactory.get(40, '1234567890123456789012345678901234567890')); ls_object.get().type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_type.get().blob); ls_object.get().data.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].string_to_xstring_utf8({iv_string: new abap.types.String().set(`Hello World`)}))); ls_object.get().index.set(abap.IntegerFactory.get(1)); abap.statements.append({source: ls_object, target: lt_objects}); ls_object.clear(); ls_object.get().sha1.set(abap.CharacterFactory.get(40, '1234567890123456789012345678901234567890')); ls_object.get().type.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_type.get().ref_d); ls_object.get().data.set(abap.CharacterFactory.get(8, '0B0D900B')); ls_object.get().index.set(abap.IntegerFactory.get(2)); abap.statements.append({source: ls_object, target: lt_objects}); lv_original_count.set(abap.builtin.lines({val: lt_objects})); await abap.Classes['ZCL_ABAPGIT_GIT_DELTA'].decode_deltas({iv_show_progress: abap.builtin.abap_false, ct_objects: lt_objects}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: lt_objects}), exp: lv_original_count, msg: abap.CharacterFactory.get(57, 'Should have same number of objects after delta processing')}); for await (const unique136 of abap.statements.loop(lt_objects)) { ls_object.set(unique136); if (abap.compare.eq(ls_object.get().type, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_type.get().ref_d)) { await abap.Classes['CL_ABAP_UNIT_ASSERT'].fail({msg: abap.CharacterFactory.get(47, 'No delta objects should remain after processing')}); } } } } abap.Classes['CLAS-ZCL_ABAPGIT_GIT_DELTA-LTCL_GIT_DELTA_TEST'] = ltcl_git_delta_test; export {ltcl_git_delta_test}; |