All files / output zcl_abapgit_git_porcelain.clas.testclasses.mjs

96.24% Statements 128/133
93.75% Branches 15/16
75% Functions 12/16
96.24% Lines 128/133

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 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 1331x 1x 1x 1x 1x 6x 6x 6x 6x 6x       6x 6x     6x 6x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 6x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 10x 6x 1x 1x 1x 1x 6x 1x 1x 1x 1x 1x 6x 1x 1x 1x 1x 1x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 1x 6x 1x 1x 1x 1x 1x 1x 1x 1x 1x 5x 5x 5x 1x 6x 1x 1x 1x 1x 6x 1x 1x
const {zcl_abapgit_git_porcelain} = await import("./zcl_abapgit_git_porcelain.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_git_porcelain.clas.testclasses.abap
 
 
class ltcl_git_porcelain {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_GIT_PORCELAIN-LTCL_GIT_PORCELAIN';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {"MT_EXPANDED": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-PATH"}),
  "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-NAME"}),
  "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
  "chmod": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_chmod"})}, "zif_abapgit_git_definitions=>ty_expanded", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"path_name","type":"SORTED","isUnique":false,"keyFields":["PATH","NAME"]}]}, "zif_abapgit_git_definitions=>ty_expanded_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "},
  "MT_TREES": {"type": () => {return abap.types.TableFactory.construct(new abap.types.Structure({
  "path": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-PATH"}),
  "data": new abap.types.XString({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-DATA"}),
  "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"})}, "zcl_abapgit_git_porcelain=>ty_tree", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_git_porcelain=>ty_trees_tt");}, "visibility": "I", "is_constant": " ", "is_class": " "}};
  static METHODS = {"SETUP": {"visibility": "I", "parameters": {}},
  "APPEND": {"visibility": "I", "parameters": {"IV_PATH": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_NAME": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}}},
  "SINGLE_FILE": {"visibility": "I", "parameters": {}},
  "TWO_FILES_SAME_PATH": {"visibility": "I", "parameters": {}},
  "ROOT_EMPTY": {"visibility": "I", "parameters": {}},
  "NAMESPACES": {"visibility": "I", "parameters": {}},
  "MORE_SUB": {"visibility": "I", "parameters": {}},
  "SUB": {"visibility": "I", "parameters": {}}};
  #mt_expanded;
  #mt_trees;
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
      "setup": this.#setup.bind(this),
      "append": this.#append.bind(this),
      "single_file": this.#single_file.bind(this),
      "two_files_same_path": this.#two_files_same_path.bind(this),
      "root_empty": this.#root_empty.bind(this),
      "namespaces": this.#namespaces.bind(this),
      "more_sub": this.#more_sub.bind(this),
      "sub": this.#sub.bind(this),
    };
    this.#mt_expanded = abap.types.TableFactory.construct(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-PATH"}),
    "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-NAME"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "chmod": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_chmod"})}, "zif_abapgit_git_definitions=>ty_expanded", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[{"name":"path_name","type":"SORTED","isUnique":false,"keyFields":["PATH","NAME"]}]}, "zif_abapgit_git_definitions=>ty_expanded_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_expanded"] = this.#mt_expanded;
    this.#mt_trees = abap.types.TableFactory.construct(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-PATH"}),
    "data": new abap.types.XString({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-DATA"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"})}, "zcl_abapgit_git_porcelain=>ty_tree", undefined, {}, {}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "zcl_abapgit_git_porcelain=>ty_trees_tt");
    this.FRIENDS_ACCESS_INSTANCE["mt_trees"] = this.#mt_trees;
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async #setup() {
    this.#mt_expanded.clear();
    this.#mt_trees.clear();
  }
  async #append(INPUT) {
    let iv_path = INPUT?.iv_path;
    if (iv_path?.getQualifiedName === undefined || iv_path.getQualifiedName() !== "STRING") { iv_path = undefined; }
    if (iv_path === undefined) { iv_path = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_path); }
    let iv_name = INPUT?.iv_name;
    if (iv_name?.getQualifiedName === undefined || iv_name.getQualifiedName() !== "STRING") { iv_name = undefined; }
    if (iv_name === undefined) { iv_name = new abap.types.String({qualifiedName: "STRING"}).set(INPUT.iv_name); }
    let fs_ls_expanded_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-PATH"}),
    "name": new abap.types.String({qualifiedName: "ZIF_ABAPGIT_GIT_DEFINITIONS=>TY_EXPANDED-NAME"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"}),
    "chmod": new abap.types.Character(6, {"qualifiedName":"zif_abapgit_git_definitions=>ty_chmod"})}, "zif_abapgit_git_definitions=>ty_expanded", undefined, {}, {}));
    fs_ls_expanded_.assign(this.#mt_expanded.appendInitial());
    fs_ls_expanded_.get().path.set(iv_path);
    fs_ls_expanded_.get().name.set(iv_name);
    fs_ls_expanded_.get().sha1.set(abap.CharacterFactory.get(1, 'a'));
    fs_ls_expanded_.get().chmod.set(abap.Classes['ZIF_ABAPGIT_GIT_DEFINITIONS'].zif_abapgit_git_definitions$c_chmod.get().file);
  }
  async #single_file() {
    await this.#append({iv_path: abap.CharacterFactory.get(1, '/'), iv_name: abap.CharacterFactory.get(10, 'foobar.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(1)});
  }
  async #two_files_same_path() {
    await this.#append({iv_path: abap.CharacterFactory.get(1, '/'), iv_name: abap.CharacterFactory.get(7, 'foo.txt')});
    await this.#append({iv_path: abap.CharacterFactory.get(1, '/'), iv_name: abap.CharacterFactory.get(7, 'bar.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(1)});
  }
  async #sub() {
    await this.#append({iv_path: abap.CharacterFactory.get(1, '/'), iv_name: abap.CharacterFactory.get(7, 'foo.txt')});
    await this.#append({iv_path: abap.CharacterFactory.get(5, '/sub/'), iv_name: abap.CharacterFactory.get(7, 'bar.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(2)});
  }
  async #more_sub() {
    let fs_ls_tree_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-PATH"}),
    "data": new abap.types.XString({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-DATA"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"})}, "zcl_abapgit_git_porcelain=>ty_tree", undefined, {}, {}));
    await this.#append({iv_path: abap.CharacterFactory.get(18, '/src/foo_a/foo_a1/'), iv_name: abap.CharacterFactory.get(6, 'a1.txt')});
    await this.#append({iv_path: abap.CharacterFactory.get(18, '/src/foo_a/foo_a2/'), iv_name: abap.CharacterFactory.get(6, 'a2.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(5)});
    for await (const unique170 of abap.statements.loop(this.#mt_trees)) {
      fs_ls_tree_.assign(unique170);
      await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_not_initial({act: fs_ls_tree_.get().data});
    }
  }
  async #namespaces() {
    let fs_ls_tree_ = new abap.types.FieldSymbol(new abap.types.Structure({
    "path": new abap.types.String({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-PATH"}),
    "data": new abap.types.XString({qualifiedName: "ZCL_ABAPGIT_GIT_PORCELAIN=>TY_TREE-DATA"}),
    "sha1": new abap.types.Character(40, {"qualifiedName":"zif_abapgit_git_definitions=>ty_sha1"})}, "zcl_abapgit_git_porcelain=>ty_tree", undefined, {}, {}));
    await this.#append({iv_path: abap.CharacterFactory.get(20, '/src/#foo#a/#foo#a1/'), iv_name: abap.CharacterFactory.get(6, 'a1.txt')});
    await this.#append({iv_path: abap.CharacterFactory.get(20, '/src/#foo#a/#foo#a2/'), iv_name: abap.CharacterFactory.get(6, 'a2.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(5)});
    for await (const unique171 of abap.statements.loop(this.#mt_trees)) {
      fs_ls_tree_.assign(unique171);
      await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_not_initial({act: fs_ls_tree_.get().data});
    }
  }
  async #root_empty() {
    await this.#append({iv_path: abap.CharacterFactory.get(5, '/sub/'), iv_name: abap.CharacterFactory.get(7, 'bar.txt')});
    this.#mt_trees.set((await abap.Classes['ZCL_ABAPGIT_GIT_PORCELAIN'].build_trees({it_expanded: this.#mt_expanded})));
    await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: abap.builtin.lines({val: this.#mt_trees}), exp: abap.IntegerFactory.get(2)});
  }
}
abap.Classes['CLAS-ZCL_ABAPGIT_GIT_PORCELAIN-LTCL_GIT_PORCELAIN'] = ltcl_git_porcelain;
export {ltcl_git_porcelain};