All files / output cl_abap_unit_assert.clas.locals.mjs

76.47% Statements 52/68
83.33% Branches 10/12
27.27% Functions 3/11
76.47% Lines 52/68

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 681x 1x 1x 1x 1x 1x 1x 1x 1x 1x             1x       1x     1x 8x 8x 8x 8x 8x 8x 8x 2x 8x   6x     6x 6x 6x 8x 8x 1x     1x 2x 2x 2x 2x 2x 2x 2x 2x 4x 4x 2x 2x 4x 4x 4x 4x 4x 2x 2x 1x 1x 1x
const {cx_root} = await import("./cx_root.clas.mjs");
// cl_abap_unit_assert.clas.locals_imp.abap
class lcl_dump {
  static INTERNAL_TYPE = 'CLAS';
  static INTERNAL_NAME = 'CLAS-CL_ABAP_UNIT_ASSERT-LCL_DUMP';
  static IMPLEMENTED_INTERFACES = [];
  static ATTRIBUTES = {};
  static METHODS = {"DUMP_STRUCTURE": {"visibility": "I", "parameters": {"RV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_VAL": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}}},
  "TO_STRING": {"visibility": "U", "parameters": {"RV_STR": {"type": () => {return new abap.types.String({qualifiedName: "STRING"});}, "is_optional": " "}, "IV_VAL": {"type": () => {return new abap.types.Character(4);}, "is_optional": " "}}}};
  constructor() {
    this.me = new abap.types.ABAPObject();
    this.me.set(this);
    this.INTERNAL_ID = abap.internalIdCounter++;
    this.FRIENDS_ACCESS_INSTANCE = {
    };
  }
  async constructor_(INPUT) {
    if (super.constructor_) { await super.constructor_(INPUT); }
    return this;
  }
  async to_string(INPUT) {
    return lcl_dump.to_string(INPUT);
  }
  static async to_string(INPUT) {
    let rv_str = new abap.types.String({qualifiedName: "STRING"});
    let iv_val = INPUT?.iv_val;
    let lv_type = new abap.types.Character(1, {});
    let lv_name = new abap.types.String({qualifiedName: "STRING"});
    abap.statements.describe({field: iv_val, type: lv_type});
    let unique1255 = lv_type;
    if (abap.compare.eq(unique1255, abap.CharacterFactory.get(1, 'u')) || abap.compare.eq(unique1255, abap.CharacterFactory.get(1, 'v'))) {
      rv_str.set((await this.dump_structure({iv_val: iv_val})));
    } else if (abap.compare.eq(unique1255, abap.CharacterFactory.get(1, 'h'))) {
      rv_str.set(new abap.types.String().set(`[itab]`));
    } else if (abap.compare.eq(unique1255, abap.CharacterFactory.get(1, 'r'))) {
      lv_name.set(iv_val.get().constructor.name);
      rv_str.set(new abap.types.String().set(`[object, ${abap.templateFormatting(lv_name)}]`));
    } else {
      rv_str.set(new abap.types.String().set(`${abap.templateFormatting(iv_val)}`));
    }
    return rv_str;
  }
  async dump_structure(INPUT) {
    return lcl_dump.dump_structure(INPUT);
  }
  static async dump_structure(INPUT) {
    let rv_str = new abap.types.String({qualifiedName: "STRING"});
    let iv_val = INPUT?.iv_val;
    let lt_components = abap.types.TableFactory.construct(new abap.types.String({qualifiedName: "STRING"}), {"withHeader":false,"keyType":"DEFAULT","primaryKey":{"name":"primary_key","type":"STANDARD","isUnique":false,"keyFields":[]},"secondary":[]}, "");
    let lv_name = new abap.types.String({qualifiedName: "STRING"});
    let lv_str = new abap.types.String({qualifiedName: "STRING"});
    let fs_fs_ = new abap.types.FieldSymbol(new abap.types.Character(4));
    Object.keys(iv_val.get()).forEach((name) => lt_components.append(new abap.types.String().set(name)));
    for await (const unique1256 of abap.statements.loop(lt_components)) {
      lv_name.set(unique1256);
      if (abap.compare.ne(rv_str, abap.CharacterFactory.get(1, ''))) {
        rv_str.set(abap.operators.concat(rv_str,new abap.types.String().set(`, `)));
      }
      abap.statements.assign({component: lv_name, target: fs_fs_, source: iv_val});
      abap.statements.assert(abap.compare.eq(abap.builtin.sy.get().subrc, abap.IntegerFactory.get(0)));
      lv_str.set((await this.to_string({iv_val: fs_fs_})));
      rv_str.set(abap.operators.concat(rv_str,abap.operators.concat(lv_name,abap.operators.concat(new abap.types.String().set(`: `),new abap.types.String().set(`${abap.templateFormatting(lv_str)}`)))));
    }
    return rv_str;
  }
}
abap.Classes['CLAS-CL_ABAP_UNIT_ASSERT-LCL_DUMP'] = lcl_dump;
export {lcl_dump};