|
@@ -198,7 +198,7 @@ export class OutputAssessmentResult {
|
|
|
|
|
|
const g_string = result.generated || "";
|
|
|
const e_string = result.expected || "";
|
|
|
- console.log("generated: ", g_string,"expected: ", e_string);
|
|
|
+ // console.log("generated: ", g_string,"expected: ", e_string);
|
|
|
let g_string_tmpl = g_string;
|
|
|
let e_string_tmpl = e_string;
|
|
|
if(result.generated == null) {
|
|
@@ -215,6 +215,7 @@ export class OutputAssessmentResult {
|
|
|
template = template.replace(":class-result:", 'assessment-string-result');
|
|
|
} else {
|
|
|
const diff = StringDiff(g_string, e_string);
|
|
|
+ // console.log(diff);
|
|
|
const diff_vec = diff.map(part => this.getDiffStringStyle(part[1], part[0]), this);
|
|
|
const diff_string = diff_vec.reduce((prev, actual) => prev + actual, "");
|
|
|
template = template.replace("$2", "<span class='assessment-failed-case'>✗</span>" + diff_string);
|
|
@@ -226,7 +227,7 @@ export class OutputAssessmentResult {
|
|
|
getDiffStringStyle (text, action) {
|
|
|
const template = "<span class='$0'>$1</span>"
|
|
|
// Fix missing whitespace when its a single element
|
|
|
- text = text.replace(/\s/g," ");
|
|
|
+ text = text.replace(/\s/g," ");
|
|
|
switch(action) {
|
|
|
case StringDiff.INSERT:
|
|
|
return template.replace("$0", "stringdiff-insert").replace("$1", text);
|