All files / client/src/lib compilation-error-state.ts

100% Statements 5/5
50% Branches 2/4
100% Functions 1/1
100% Lines 5/5

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                      2x     1x 1x 1x   1x                  
export type OutputTab = "compiler" | "messages" | "registry" | "debug";
 
export interface GccCompilationErrorState {
  cliOutput: string;
  hasCompilationErrors: true;
  lastCompilationResult: "error";
  showCompilationOutput: true;
  parserPanelDismissed: false;
  activeOutputTab: "compiler";
}
 
export const buildGccCompilationErrorState = (
  messageData: string | null | undefined,
): GccCompilationErrorState => {
  const details = typeof messageData === "string" ? messageData : "";
  const prefix = "\u274C GCC Compilation Error:";
  const cliOutput = details ? `${prefix}\n\n${details}` : prefix;
 
  return {
    cliOutput,
    hasCompilationErrors: true,
    lastCompilationResult: "error",
    showCompilationOutput: true,
    parserPanelDismissed: false,
    activeOutputTab: "compiler",
  };
};