diff --git a/i18n/en.ts b/i18n/en.ts index 69af2976d9bf106d6dc63e2c76eeddff38bb5f4e..5812a3180ac39efcc4af7176131221db085b503d 100644 --- a/i18n/en.ts +++ b/i18n/en.ts @@ -295,6 +295,7 @@ export const lang_en: LangObj = { "Program": "Program", "The test protocol exceeded the character limit and was truncated. However your test can still pass because character limit is only used to limit the memory used to store the test result. New lines characters are counted as 4 characters. There are some characters (~100) reserved for header data and each test protocol line consumes some additional characters (depending on the protocol entry type)." : "The test protocol exceeded the character limit and was truncated. However your test can still pass because character limit is only used to limit the memory used to store the test result. New lines characters are counted as 4 characters. There are some characters (~100) reserved for header data and each test protocol line consumes some additional characters (depending on the protocol entry type).", "Load full output" : "Load full output", + "Test syntax": "Test syntax", "Test content read timeout" : "Test content read timeout", "Exit code mismatch" : "Exit code mismatch", diff --git a/i18n/i18nRoot.ts b/i18n/i18nRoot.ts index b2e1d4aa488800439d10fa27593ec2538a2ff218..527153aa5480584bcf8f5b611dcb369fdc32e559 100644 --- a/i18n/i18nRoot.ts +++ b/i18n/i18nRoot.ts @@ -299,6 +299,7 @@ export interface LangObj { "Program": string "The test protocol exceeded the character limit and was truncated. However your test can still pass because character limit is only used to limit the memory used to store the test result. New lines characters are counted as 4 characters. There are some characters (~100) reserved for header data and each test protocol line consumes some additional characters (depending on the protocol entry type).": string "Load full output": string + "Test syntax": string "Test content read timeout": string "Exit code mismatch": string diff --git a/src/components/siteSideMenu/menu.tsx b/src/components/siteSideMenu/menu.tsx index a0753e509a999f1a86899ad0eec23e16d69c4ae5..abc0b1e4c61aadeabca460bc29601668f1c649fc 100644 --- a/src/components/siteSideMenu/menu.tsx +++ b/src/components/siteSideMenu/menu.tsx @@ -14,6 +14,7 @@ import {Icon} from "semantic-ui-react"; import {SimpleDividerWithSpace} from "../helpers/simpleDividerWithSpace"; import {SimpleVDivider} from "../helpers/simpleVDivider"; import {getI18n} from "../../../i18n/i18nRoot"; +import {markdownSiteTestSyntaxGuide} from '../../constants' //const css = require('./styles.styl'); @@ -250,6 +251,19 @@ class menu extends React.Component<Props, any> { </div> } + + <div> + <Link to={constants.markdownSiteTestSyntaxGuide} target="_blank" onClick={() => this.linkClicked()}> + <Icon size="huge" name='book'/> + <span> + { + getI18n(this.props.langId,'Test syntax') + } + </span> + </Link> + </div> + + </div> </div> diff --git a/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx b/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx index f1e70ac967106c4b3ded8fb12ae0a63fcfdd2d03..e283855893b907fa651b523855210f48020d6c1d 100644 --- a/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx +++ b/src/components/sites/doExerciseSite/consolePanel/consoleItem.tsx @@ -228,6 +228,7 @@ const allAsciiColorCodes = Object.keys(asciiColorCodeMap) class consoleItem extends React.Component<Props, any> { + //note that \u001B is sometimes wrongly interpreted as \1xB (which is not the same) (after the test ran) convertConsoleLineToAsciiColoredLine(line: string): ReadonlyArray<JSX.Element> | string { if (line.includes('\\0') === false) { @@ -541,11 +542,14 @@ class consoleItem extends React.Component<Props, any> { } { + //output mismatched (this.props.item.hasOutputMismatched && ( + // false & true + //diff and/but no regex --> show colors !this.props.useDiffIfOutputMismatched - || (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) + && (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"> @@ -557,6 +561,47 @@ class consoleItem extends React.Component<Props, any> { </div> } { + //output mismatched + (this.props.item.hasOutputMismatched + && + ( + // false & false + //diff and/but no regex --> show colors + !this.props.useDiffIfOutputMismatched + && (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"> + <pre className="mar-null"> + { + this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content)) + } + </pre> + </div> + } + { + //output mismatched + (this.props.item.hasOutputMismatched + && + ( + // true & true + //diff and regex --> show normal to see regex + this.props.useDiffIfOutputMismatched + && (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"> + <pre className="mar-null"> + { + contentTransformer(this.props.item.content) + } + </pre> + </div> + } + { + // true & false + //diff and no regex + //--> no ascii color interpretation //diff output, if we use diff output we cannot use regex because this doesn't make sense (this.props.item.hasOutputMismatched && this.props.useDiffIfOutputMismatched && (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) @@ -653,8 +698,8 @@ class consoleItem extends React.Component<Props, any> { { startsWith(this.props.item.content, "(regex):") - ? contentTransformer(this.props.item.content.substr("(regex):".length)) - : contentTransformer(this.props.item.content) + ? this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content.substr("(regex):".length))) + : this.convertConsoleLineToAsciiColoredLine(contentTransformer(this.props.item.content)) } </pre> </div>