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 100 101 102 103 104 105 106 | 1x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 1x 1x 1x 1x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 3x 3x 3x 3x 3x 3x 3x 3x 3x 4x 5x 1x 1x 1x 1x 1x 5x 1x 1x 1x 1x 1x 5x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 1x 1x 1x 1x 1x 5x 1x 1x 1x 1x 1x 1x 1x 1x 5x 1x 1x | const {zcl_abapgit_git_branch_list} = await import("./zcl_abapgit_git_branch_list.clas.mjs"); const {cx_root} = await import("./cx_root.clas.mjs"); // zcl_abapgit_git_branch_list.clas.testclasses.abap class ltcl_parse { static INTERNAL_TYPE = 'CLAS'; static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_GIT_BRANCH_LIST-LTCL_PARSE'; static IMPLEMENTED_INTERFACES = []; static ATTRIBUTES = {"MT_DATA": {"type": () => {return abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");}, "visibility": "I", "is_constant": " ", "is_class": " "}}; static METHODS = {"PARSE": {"visibility": "I", "parameters": {"IV_EXPECTED_LINES": {"type": () => {return new abap.types.Integer({qualifiedName: "I"});}, "is_optional": " "}}}, "PARSE_OK_WITHOUT_FIRST_LF": {"visibility": "I", "parameters": {}}, "PARSE_WORKS": {"visibility": "I", "parameters": {}}, "CAPTCHA_RESPONSE_IS_CAUGHT": {"visibility": "I", "parameters": {}}, "PARSE_RAW": {"visibility": "I", "parameters": {}}, "USE_REFS_IF_HEAD_IS_MISSING": {"visibility": "I", "parameters": {}}}; #mt_data; constructor() { this.me = new abap.types.ABAPObject(); this.me.set(this); this.INTERNAL_ID = abap.internalIdCounter++; this.FRIENDS_ACCESS_INSTANCE = { "parse": this.#parse.bind(this), "parse_ok_without_first_lf": this.#parse_ok_without_first_lf.bind(this), "parse_works": this.#parse_works.bind(this), "captcha_response_is_caught": this.#captcha_response_is_caught.bind(this), "parse_raw": this.#parse_raw.bind(this), "use_refs_if_head_is_missing": this.#use_refs_if_head_is_missing.bind(this), }; this.#mt_data = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, ""); this.FRIENDS_ACCESS_INSTANCE["mt_data"] = this.#mt_data; } async constructor_(INPUT) { if (super.constructor_) { await super.constructor_(INPUT); } return this; } async #parse(INPUT) { let iv_expected_lines = new abap.types.Integer({qualifiedName: "I"}); if (INPUT && INPUT.iv_expected_lines) {iv_expected_lines.set(INPUT.iv_expected_lines);} if (INPUT === undefined || INPUT.iv_expected_lines === undefined) {iv_expected_lines = abap.IntegerFactory.get(2);} let lv_data = new abap.types.String({qualifiedName: "STRING"}); let lt_list = abap.types.TableFactory.construct(new abap.types.Structure({ "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}), "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-NAME"}), "type": new abap.types.Character(2, {"qualifiedName":"zif_abapgit_git_definitions=>ty_git_branch_type"}), "is_head": new abap.types.Character(1, {"qualifiedName":"ABAP_BOOL","ddicName":"ABAP_BOOL"}), "display_name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_GIT_BRANCH-DISPLAY_NAME"})}, "zif_abapgit_git_definitions=>ty_git_branch", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"name_key","type":"SORTED","isUnique":false,"keyFields":["NAME"]}]}, "zif_abapgit_git_definitions=>ty_git_branch_list_tt"); abap.statements.concatenate({source: [this.#mt_data], target: lv_data, separatedBy: abap.Classes['CL_ABAP_CHAR_UTILITIES'].newline, lines: true}); await abap.Classes['ZCL_ABAPGIT_GIT_BRANCH_LIST'].parse_branch_list({iv_data: lv_data, et_list: lt_list}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_not_initial({act: lt_list}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: lt_list}), exp: iv_expected_lines}); abap.statements.readTable(lt_list,{keyName: "name_key", withTableKey: true, withKey: (i) => {return abap.compare.eq(i.name, abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().main);}, withKeyValue: [{key: (i) => {return i.name}, value: abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().main}], usesTableLine: false, withKeySimple: {"name": abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_git_branch.get().main}}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_subrc(); } async #parse_ok_without_first_lf() { abap.statements.append({source: abap.CharacterFactory.get(87, '001d# service=git-upload-pack000000d2b5d5f1f84ebcaeb8a299edd14c959518e9d81bb5 HEAD#asdf'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(60, '003fb5d5f1f84ebcaeb8a299edd14c959518e9d81bb5 refs/heads/main'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(4, '0000'), target: this.#mt_data}); await this.#parse(); } async #parse_works() { abap.statements.append({source: abap.CharacterFactory.get(29, '001e# service=git-upload-pack'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(58, '000001080e6fe6b311f789ccbac6c5122702d4f48a4f6bda HEAD#asdf'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(60, '003f0e6fe6b311f789ccbac6c5122702d4f48a4f6bda refs/heads/main'), target: this.#mt_data}); await this.#parse(); } async #captcha_response_is_caught() { let lx_error = new abap.types.ABAPObject({qualifiedName: "ZCX_ABAPGIT_EXCEPTION", RTTIName: "\\CLASS=ZCX_ABAPGIT_EXCEPTION"}); let lv_data = new abap.types.String({qualifiedName: "STRING"}); lv_data.set(new abap.types.String().set(`001e\n service=git-upload-pack\n00000230ERR CAPTCHA required\nYour Bitbucket account etc..`)); abap.statements.append({source: lv_data, target: this.#mt_data}); try { await this.#parse(); await abap.Classes['CL_ABAP_UNIT_ASSERT'].fail(); } catch (e) { if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) { lx_error.set(e); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_char_cp({act: (await lx_error.get().if_message$get_text()), exp: abap.CharacterFactory.get(9, '*CAPTCHA*')}); } else { throw e; } } } async #use_refs_if_head_is_missing() { abap.statements.append({source: abap.CharacterFactory.get(29, '001e# service=git-upload-pack'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(64, '000000f7e6e5b066fb4177bf0780bf343ab2de06368dd973 refs/heads/main'), target: this.#mt_data}); abap.statements.append({source: abap.CharacterFactory.get(4, '0000'), target: this.#mt_data}); await this.#parse({iv_expected_lines: abap.IntegerFactory.get(1)}); } async #parse_raw() { let lv_xstr = new abap.types.XString({qualifiedName: "XSTRING"}); let lv_data = new abap.types.String({qualifiedName: "STRING"}); let lv_ref = new abap.types.String({qualifiedName: "STRING"}); lv_xstr.set(abap.operators.concat(abap.CharacterFactory.get(40, '303031652320736572766963653D6769742D7570'),abap.operators.concat(abap.CharacterFactory.get(40, '6C6F61642D7061636B0A30303030303135346639'),abap.operators.concat(abap.CharacterFactory.get(40, '6563323364366439333561613764633236656531'),abap.operators.concat(abap.CharacterFactory.get(40, '3431633762343666656564396434363835652048'),abap.operators.concat(abap.CharacterFactory.get(40, '454144006D756C74695F61636B207468696E2D70'),abap.operators.concat(abap.CharacterFactory.get(40, '61636B20736964652D62616E6420736964652D62'),abap.operators.concat(abap.CharacterFactory.get(40, '616E642D36346B206F66732D64656C7461207368'),abap.operators.concat(abap.CharacterFactory.get(40, '616C6C6F772064656570656E2D73696E63652064'),abap.operators.concat(abap.CharacterFactory.get(40, '656570656E2D6E6F742064656570656E2D72656C'),abap.operators.concat(abap.CharacterFactory.get(40, '6174697665206E6F2D70726F677265737320696E'),abap.operators.concat(abap.CharacterFactory.get(40, '636C7564652D746167206D756C74695F61636B5F'),abap.operators.concat(abap.CharacterFactory.get(40, '64657461696C656420616C6C6F772D7469702D73'),abap.operators.concat(abap.CharacterFactory.get(40, '6861312D696E2D77616E7420616C6C6F772D7265'),abap.operators.concat(abap.CharacterFactory.get(40, '61636861626C652D736861312D696E2D77616E74'),abap.operators.concat(abap.CharacterFactory.get(40, '206E6F2D646F6E652073796D7265663D48454144'),abap.operators.concat(abap.CharacterFactory.get(40, '3A726566732F68656164732F6D61696E2066696C'),abap.operators.concat(abap.CharacterFactory.get(40, '746572206F626A6563742D666F726D61743D7368'),abap.operators.concat(abap.CharacterFactory.get(40, '6131206167656E743D6769742F6769746875622D'),abap.operators.concat(abap.CharacterFactory.get(40, '673964323537636462383634300A303033646639'),abap.operators.concat(abap.CharacterFactory.get(40, '6563323364366439333561613764633236656531'),abap.operators.concat(abap.CharacterFactory.get(40, '3431633762343666656564396434363835652072'),abap.CharacterFactory.get(38, '6566732F68656164732F6D61696E0A30303030'))))))))))))))))))))))); lv_data.set((await abap.Classes['ZCL_ABAPGIT_CONVERT'].xstring_to_string_utf8({iv_data: lv_xstr}))); await abap.Classes['ZCL_ABAPGIT_GIT_BRANCH_LIST'].parse_branch_list({iv_data: lv_data, ev_head_symref: lv_ref}); await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_char_cp({act: lv_ref, exp: abap.CharacterFactory.get(15, 'refs/heads/main')}); } } abap.Classes['CLAS-ZCL_ABAPGIT_GIT_BRANCH_LIST-LTCL_PARSE'] = ltcl_parse; export {ltcl_parse}; |