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 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | const {zcl_abapgit_xml_pretty} = await import("./zcl_abapgit_xml_pretty.clas.mjs");
const {cx_root} = await import("./cx_root.clas.mjs");
// zcl_abapgit_xml_pretty.clas.testclasses.abap
class ltcl_test {
static STATIC_SUPER = undefined;
static INTERNAL_TYPE = 'CLAS';
static INTERNAL_NAME = 'CLAS-ZCL_ABAPGIT_XML_PRETTY-LTCL_TEST';
static IMPLEMENTED_INTERFACES = [];
static ATTRIBUTES = {"MO_CUT": {"type": () => {return new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_XML_PRETTY", RTTIName: "\\CLASS=ZCL_ABAPGIT_XML_PRETTY"});}, "visibility": "I", "is_constant": " ", "is_class": " "}};
static METHODS = {"SETUP": {"visibility": "I", "parameters": {}},
"PRETTY1": {"visibility": "I", "parameters": {}},
"PRETTY2": {"visibility": "I", "parameters": {}},
"PRETTY3": {"visibility": "I", "parameters": {}},
"MALFORMATTED": {"visibility": "I", "parameters": {}},
"DONT_IGNORE_ERROR": {"visibility": "I", "parameters": {}},
"UNPRETTY": {"visibility": "I", "parameters": {}}};
#mo_cut;
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),
"pretty1": this.#pretty1.bind(this),
"pretty2": this.#pretty2.bind(this),
"pretty3": this.#pretty3.bind(this),
"malformatted": this.#malformatted.bind(this),
"dont_ignore_error": this.#dont_ignore_error.bind(this),
"unpretty": this.#unpretty.bind(this),
};
this.#mo_cut = new abap.types.ABAPObject({qualifiedName: "ZCL_ABAPGIT_XML_PRETTY", RTTIName: "\\CLASS=ZCL_ABAPGIT_XML_PRETTY"});
this.FRIENDS_ACCESS_INSTANCE["mo_cut"] = this.#mo_cut;
}
async constructor_(INPUT) {
if (super.constructor_) { await super.constructor_(INPUT); }
return this;
}
async #setup() {
this.#mo_cut.set(await (new abap.Classes['ZCL_ABAPGIT_XML_PRETTY']()).constructor_());
}
async #pretty1() {
let lv_result = new abap.types.String({qualifiedName: "STRING"});
lv_result.set((await this.#mo_cut.get().print({iv_xml: abap.CharacterFactory.get(11, '<foo></foo>')})));
if (abap.compare.gt(abap.Classes['CL_ABAP_CHAR_UTILITIES'].charsize, abap.IntegerFactory.get(1))) {
lv_result.set(lv_result.getOffset({offset: 1}));
}
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_result, exp: new abap.types.String().set(`<?xml version="1.0" encoding="utf-16"?>\n<foo/>\n`)});
}
async #pretty2() {
let lv_result = new abap.types.String({qualifiedName: "STRING"});
lv_result.set((await this.#mo_cut.get().print({iv_xml: abap.CharacterFactory.get(12, '<foo>2</foo>')})));
if (abap.compare.gt(abap.Classes['CL_ABAP_CHAR_UTILITIES'].charsize, abap.IntegerFactory.get(1))) {
lv_result.set(lv_result.getOffset({offset: 1}));
}
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_result, exp: new abap.types.String().set(`<?xml version="1.0" encoding="utf-16"?>\n<foo>2</foo>\n`)});
}
async #pretty3() {
let lv_result = new abap.types.String({qualifiedName: "STRING"});
lv_result.set((await this.#mo_cut.get().print({iv_xml: abap.CharacterFactory.get(23, '<foo><bar>2</bar></foo>')})));
if (abap.compare.gt(abap.Classes['CL_ABAP_CHAR_UTILITIES'].charsize, abap.IntegerFactory.get(1))) {
lv_result.set(lv_result.getOffset({offset: 1}));
}
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_result, exp: new abap.types.String().set(`<?xml version="1.0" encoding="utf-16"?>\n<foo>\n <bar>2</bar>\n</foo>\n`)});
}
async #malformatted() {
let lv_result = new abap.types.String({qualifiedName: "STRING"});
lv_result.set((await this.#mo_cut.get().print({iv_xml: abap.CharacterFactory.get(3, 'abc')})));
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_result, exp: abap.CharacterFactory.get(3, 'abc')});
}
async #dont_ignore_error() {
try {
await this.#mo_cut.get().print({iv_xml: abap.CharacterFactory.get(3, 'abc'), iv_ignore_errors: abap.builtin.abap_false});
await abap.Classes['CL_ABAP_UNIT_ASSERT'].fail();
} catch (e) {
if ((abap.Classes['ZCX_ABAPGIT_EXCEPTION'] && e instanceof abap.Classes['ZCX_ABAPGIT_EXCEPTION'])) {
return;
} else {
throw e;
}
}
}
async #unpretty() {
let lv_result = new abap.types.String({qualifiedName: "STRING"});
lv_result.set((await this.#mo_cut.get().print({iv_xml: new abap.types.String().set(`<foo>\n <bar>2</bar>\n</foo>`), iv_unpretty: abap.builtin.abap_true})));
if (abap.compare.gt(abap.Classes['CL_ABAP_CHAR_UTILITIES'].charsize, abap.IntegerFactory.get(1))) {
lv_result.set(lv_result.getOffset({offset: 1}));
}
await abap.Classes['CL_ABAP_UNIT_ASSERT'].assert_equals({act: lv_result, exp: new abap.types.String().set(`<?xml version="1.0" encoding="utf-16"?><foo><bar>2</bar></foo>`)});
}
}
abap.Classes['CLAS-ZCL_ABAPGIT_XML_PRETTY-LTCL_TEST'] = ltcl_test;
export {ltcl_test}; |