diff --git a/i18n/en.ts b/i18n/en.ts index 435701c99c0a5d707d437101a324762c665ac7a0..91be421d6038df790c2d0fa26950121340409411 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -262,6 +262,7 @@ export const lang_en: LangObj = { "unknown/ignored line": "unknown/ignored line", "The previous (your) output was wrong. This is the correct output. Blue characters are missing, red ones are too much (inside your output) [For regex lines, starting with '(regex):' there is no diff display option].": "The previous (your) output was wrong. This is the correct output. Blue characters are missing, red ones are too much (inside your output) [For regex lines, starting with '(regex):' there is no diff display option].", "The previous (your) output was wrong. This is the correct output.": "The previous (your) output was wrong. This is the correct output.", + "Your output must match this regex" : "Your output must match this regex", "Use diff": "Use diff", "If enabled and your output was wrong then the diff against the expected output is displayed as your output. If disabled the wrong output is marked red instead. For further help (if enabled) hover over the rectangle left to the expected output.": "If enabled and your output was wrong then the diff against the expected output is displayed as your output. If disabled the wrong output is marked red instead. For further help (if enabled) hover over the rectangle left to the expected output.", "Replace Spaces": "Replace Spaces", diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts index 971aa0f19cdef2450144f3c6ea4976810900d170..45ca696584b5ad50ab5ee47224c9954223097132 100644 --- a/i18n/i18nRoot.ts +++ b/i18n/i18nRoot.ts @@ -265,6 +265,7 @@ export interface LangObj { "unknown/ignored line": string "The previous (your) output was wrong. This is the correct output. Blue characters are missing, red ones are too much (inside your output) [For regex lines, starting with '(regex):' there is no diff display option].": string "The previous (your) output was wrong. This is the correct output.": string + "Your output must match this regex": string "Use diff": string "If enabled and your output was wrong then the diff against the expected output is displayed as your output. If disabled the wrong output is marked red instead. For further help (if enabled) hover over the rectangle left to the expected output.": string "Replace Spaces": string diff --git a/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx b/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx index 7926365a98a596a26709c5e60b2eb334ebc3b665..d400f29ef68f18c1f38acb85301e27ff7540c055 100644 --- a/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx +++ b/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx @@ -486,11 +486,26 @@ class consoleItem extends React.Component<Props, any> { </div> } { - //output (user program, if hasOutputMismatched color differently to indicate error) + this.props.item.type === TestProtocolType.isMissingOutput && + <div className="console-input-output-line"> + <div className="input-part"> + </div> + <div className={'program-part-mismatch'}> + </div> + <div className="output-part bg-white-colored"> + <div> + <pre className="mar-null not-important-colored" style={{fontStyle: 'italic'}}> + missing + <span className="white-colored" style={{pointerEvents: 'none'}}>no.</span> + </pre> + </div> + </div> + </div> + } + { this.props.item.type === TestProtocolType.isOutput && <div className="console-input-output-line"> <div className="input-part"> - </div> <div className={this.props.item.hasOutputMismatched ? 'program-part-mismatch' @@ -504,9 +519,22 @@ class consoleItem extends React.Component<Props, any> { !this.props.item.hasOutputMismatched && <div> <pre className="mar-null"> + { + startsWith(this.props.item.content, "(regex):") && + <MyPopup trigger={ + <Icon className="hoverable" name="registered"/> + } + content={getI18n(this.props.langId, "Your output must match this regex")} + position="top left" + offset={leftIconPopupOffset + 5} + wide + /> + } { //only convert color if all is ok... else we have an mismatch and we want to compare...no colors - this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content)) + startsWith(this.props.item.content, "(regex):") + ? this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content.substr("(regex):".length))) + : this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content)) } </pre> </div> @@ -517,7 +545,7 @@ class consoleItem extends React.Component<Props, any> { && ( !this.props.useDiffIfOutputMismatched - || startsWith(this.props.item.content, "(regex):") + || (this.props.nextItem !== null && startsWith(this.props.nextItem.content, "(regex):")) //if next item is an expected regex then do output without showing diff... (other branch of see bot regex case) ) ) && <div className="error-colored"> @@ -531,7 +559,7 @@ class consoleItem extends React.Component<Props, any> { { //diff output, if we use diff output we cannot use regex because this doesn't make sense (this.props.item.hasOutputMismatched && this.props.useDiffIfOutputMismatched - && !startsWith(this.props.item.content, "(regex):") + && (this.props.nextItem === null || !startsWith(this.props.nextItem.content, "(regex):")) //if next item is an expected regex then do not show diff (because not possible for regex) ) && <div> <pre className="mar-null"> @@ -612,7 +640,21 @@ class consoleItem extends React.Component<Props, any> { <div> <pre className="mar-null"> { - contentTransformer(this.props.item.content) + startsWith(this.props.item.content, "(regex):") && + <MyPopup trigger={ + <Icon className="hoverable" name="registered"/> + } + content={getI18n(this.props.langId, "Your output must match this regex")} + position="top left" + offset={leftIconPopupOffset + 5} + wide + /> + } + + { + startsWith(this.props.item.content, "(regex):") + ? contentTransformer(this.props.item.content.substr("(regex):".length)) + : contentTransformer(this.props.item.content) } </pre> </div> @@ -678,20 +720,27 @@ class consoleItem extends React.Component<Props, any> { horizontalOffset={leftIconPopupOffset} content={ <div className="flexed-h stacked-checkboxes"> - <Checkbox label={`${getI18n(this.props.langId, "Ignore case")} (${CompareTestOptions.ignoreCase})`} - checked={compareTest.ignoreCase} - disabled + <Checkbox + label={`${getI18n(this.props.langId, "Ignore case")} (${CompareTestOptions.ignoreCase})`} + checked={compareTest.ignoreCase} + disabled /> <Checkbox - label={`${getI18n(this.props.langId, "Ignore all additional empty lines in the user file")} (${CompareTestOptions.ignoreAllEmptyOrWhitespacesOnlyLines})`} + label={`${getI18n(this.props.langId, + "Ignore all additional empty lines in the user file" + )} (${CompareTestOptions.ignoreAllEmptyOrWhitespacesOnlyLines})`} checked={compareTest.ignoreAllEmptyOrWhitespacesOnlyLines} disabled /> - <Checkbox label={`${getI18n(this.props.langId, "Ignore leading whitespaces")} (${CompareTestOptions.ignoreLeadingWhitespaces})`} + <Checkbox label={`${getI18n(this.props.langId, + "Ignore leading whitespaces" + )} (${CompareTestOptions.ignoreLeadingWhitespaces})`} checked={compareTest.ignoreLeadingWhitespaces} disabled /> - <Checkbox label={`${getI18n(this.props.langId, "Ignore trailing whitespaces")} (${CompareTestOptions.ignoreTrailingWhitespaces})`} + <Checkbox label={`${getI18n(this.props.langId, + "Ignore trailing whitespaces" + )} (${CompareTestOptions.ignoreTrailingWhitespaces})`} checked={compareTest.ignoreTrailingWhitespaces} disabled /> diff --git a/src/constants.ts b/src/constants.ts index a018fa08aad843f9455df35c4f25924fdc887701..982f45fb81bf73b35a8d9fc93372ab4aa8386735 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -13,7 +13,7 @@ import Logger from './helpers/logger' * y - breaking changes / new features * z - fixes, small changes */ -export const versionString = '2.5.5' +export const versionString = '2.5.6' export const supportMail = 'yapex@informatik.uni-halle.de' diff --git a/src/helpers/convertersAndTransformers.ts b/src/helpers/convertersAndTransformers.ts index b81bbf9f007922c390ff2835bb302935376a253d..986d35341dae67b91a4092b0187fdc3fd4996d66 100644 --- a/src/helpers/convertersAndTransformers.ts +++ b/src/helpers/convertersAndTransformers.ts @@ -783,6 +783,12 @@ export function convertTestProtocol(protocol: ReadonlyArray<string>, content: TestProtocol.endOfUserProgramString, } // this is the last because only e would also match expected and vice versa + } else if (line === TestProtocol.missingOutput) { + return { + type: TestProtocolType.isMissingOutput, + hasOutputMismatched: false, + content: '', + } } else if (line.length > 0 && line[0] === TestProtocol.regexOutputSign) { return { diff --git a/src/styles/common.styl b/src/styles/common.styl index f6e330f5d31484ec8bd190497e20a06a382e7d8d..40effa713d1cdad64f62a59e24d97d5c4fecbec3 100644 --- a/src/styles/common.styl +++ b/src/styles/common.styl @@ -70,6 +70,9 @@ add(a, b) .light-grey-bg-colored { background-color #e9e9e9 } +.bg-white-colored { + background-color white +} .grey-colored { color lightgrey diff --git a/src/types/testResults.ts b/src/types/testResults.ts index c323b6af7be36a5dbd9c632b9db97780a3d2c0ec..a622e9064bb708917707ce231fbc1b99d9be2046 100644 --- a/src/types/testResults.ts +++ b/src/types/testResults.ts @@ -240,6 +240,7 @@ export enum TestResultCodes { /** * the test protocol from test server (e.g. regex blackbox line is missing because this is a normal output) * @see TestProtocol + * @see convertTestProtocolFromString */ export enum TestProtocolType { /** @@ -273,6 +274,11 @@ export enum TestProtocolType { */ isExitCode, + /** + * we expected output but the user program didn't output anything + */ + isMissingOutput, + /** * the expected user program exit code line * if we have an exit code and expected exit code the expected exit code must be the next item after the exit code diff --git a/src/types/testsAndTestProtocol.ts b/src/types/testsAndTestProtocol.ts index c7eeec8f0e6b55f380828f737e8ac0e00f349e55..e196d5bea096ff77b57168dd8789ec0eceeee4f8 100644 --- a/src/types/testsAndTestProtocol.ts +++ b/src/types/testsAndTestProtocol.ts @@ -562,6 +562,7 @@ export interface TestAnswerFromBackend { * * the test protocol lines can start with these characters... * @see TestProtocolType + * @see convertTestProtocolFromString */ export enum TestProtocol { /** @@ -586,6 +587,12 @@ export enum TestProtocol { * the protocol string that indicates an error */ errorPrefix = 'error:', + + /** + * we expected output but the user program didn't output anything + */ + missingOutput = 'miss', + /** * the protocol string that indicates a output line that was expected but not outputted from the user program */