src/hmisc/scripts/nim_test

    Dark Mode
Search:
Group by:
  Source   Edit

Types

GccLocation = object
  caret*: GccPoint
  finish*: Option[GccPoint]
  Source   Edit
GccPoint = object
  byteColumn*: int
  displayColumn*: int
  line*: int
  file*: string
  column*: int
  Source   Edit
GccReport = object
  kind*: string
  columnOrigin*: int
  children*: seq[GccReportChild]
  locations*: seq[GccLocation]
  message*: string
  options*: seq[string]
  Source   Edit
NimError = enum
  neNone, neException, neCannotOpen, neOverloadFail, neInvalidIndentation,
  neAmbiguousCall, neLdFail, neGccFail
  Source   Edit
NimFixit = object
  file*: Option[AbsFile]
  line*: Option[int]
  column*: Option[int]
  message*: string
  Source   Edit
NimHint = enum
  nfSuccess = "Success", nfSuccessX = "SuccessX", nfCC = "CC",
  nfLineTooLong = "LineTooLong", nfXDeclaredButNotUsed = "XDeclaredButNotUsed",
  nfDuplicateModuleImport = "DuplicateModuleImport",
  nfXCannotRaiseY = "XCannotRaiseY",
  nfConvToBaseNotNeeded = "ConvToBaseNotNeeded",
  nfConvFromXtoItselfNotNeeded = "ConvFromXtoItselfNotNeeded",
  nfExprAlwaysX = "ExprAlwaysX", nfQuitCalled = "QuitCalled",
  nfProcessing = "Processing", nfProcessingStmt = "ProcessingStmt",
  nfCodeBegin = "CodeBegin", nfCodeEnd = "CodeEnd", nfConf = "Conf",
  nfPath = "Path", nfCondTrue = "CondTrue", nfCondFalse = "CondFalse",
  nfName = "Name", nfPattern = "Pattern", nfExec = "Exec", nfLink = "Link",
  nfDependency = "Dependency", nfSource = "Source",
  nfPerformance = "Performance", nfStackTrace = "StackTrace",
  nfGCStats = "GCStats", nfGlobalVar = "GlobalVar",
  nfExpandMacro = "ExpandMacro", nfUser = "User", nfUserRaw = "UserRaw",
  nfExtendedContext = "ExtendedContext", nfMsgOrigin = "MsgOrigin",
  nfDeclaredLoc = "DeclaredLoc"
  Source   Edit
NimOutputCheck = enum
  ocIgnore = "ignore", ocEqual = "equal", ocSubstr = "substr"
  Source   Edit
NimOverloadAlt = object
  signature*: string
  argumentFail*: string
  isOfType*: Option[string]
  Source   Edit
NimReport = object
  parts*: seq[NimReportPart]
  fixit*: seq[NimFixit]
  case kind*: NimReportKind
  of nrHint:
      hint*: NimHint

  of nrWarning:
      warning*: NimWarning

  of nrError:
      case error*: NimError
      of neAmbiguousCall:
          definedAlts*: seq[tuple[kind: string, name: string,
                                  definedIn: AbsFile, line: int, column: int]]
          matchFor*: string

      of neLdFail:
          ldReport*: tuple[message: string, compile: seq[string]]

      of neOverloadFail:
          overloadContext*: tuple[gotType: string, alts: seq[NimOverloadAlt],
                                  expression: string]

      of neGccFail:
          gccReport*: tuple[diags: seq[seq[GccReport]], compile: seq[string]]

      else:
          nil

    
  
  Source   Edit
NimReportKind = enum
  nrHint, nrWarning, nrError
  Source   Edit
NimReportPart = object
  file*: string
  line*: int
  column*: int
  text*: string
  case kind*: NimReportPartKind
  of nrpProcessingImports:
      imports*: string
      target*: AbsFile
      level*: int
      isInclude*: bool
      isToplevel*: bool

  else:
      nil

  
  Source   Edit
NimReportPartKind = enum
  nrpNone, nrpInstOf, nrpException, nrpTracePart, nrpProcessingImports,
  nrpLdFail
  Source   Edit
NimResultKind = enum
  reNimcCrash,              ## nim compiler seems to have crashed
  reMsgsDiffer,             ## error messages differ
  reFilesDiffer,            ## expected and given filenames differ
  reLinesDiffer,            ## expected and given line numbers differ
  reOutputsDiffer, reExitcodesDiffer, ## exit codes of program or of valgrind differ
  reTimeout, reInvalidPeg, reCodegenFailure, reCodeNotFound, reExeNotFound, reInstallFailed, ## package installation failed
  reBuildFailed,            ## package building failed
  reDisabled,               ## test is disabled
  reJoined,                 ## test is disabled because it was joined into the megatest
  reSuccess,                ## test was successful
  reInvalidSpec              ## test had problems to parse the spec
  Source   Edit
NimRun = object
  flags: set[NimFlag]
  gc: NimGc
  backend: NimBackend
  file: AbsFile
  outFile: AbsFile
  tmpDir: AbsDir
  spec: Option[NimTestSpec]
  Source   Edit
NimRunFailDesc = object
  run*: NimRun
  compileRes*: ShellResult
  msg*: string
  Source   Edit
NimState = object
  paths*: seq[AbsDir]
  hints*: set[NimWarning]
  flags*: seq[NimFlag]
  nimblePath*: AbsDir
  Source   Edit
NimTestAction = enum
  actionRun = "run", actionCompile = "compile", actionReject = "reject"
  Source   Edit
NimTestSpec = object
  action*: NimTestAction
  file*: AbsFile
  msg*: string
  exitCode*: int
  cmd*: string
  input*: string
  outputCheck*: NimOutputCheck
  sortoutput*: bool
  output*: string
  line*, column*: int
  ccodeCheck*: seq[string]
  maxCodeSize*: int
  err*: NimResultKind
  inCurrentBatch*: bool
  targets*: set[NimBackend]
  matrix*: seq[string]
  nimout*: string
  nimoutFull*: bool
  joinable*: bool
  unbatchable*: bool
  timeout*: float
  debugInfo*: string
  Source   Edit
NimWarning = enum
  nwCannotOpenFile = "CannotOpenFile", nwOctalEscape = "OctalEscape",
  nwXIsNeverRead = "XIsNeverRead", nwXmightNotBeenInit = "XmightNotBeenInit",
  nwDeprecated = "Deprecated", nwConfigDeprecated = "ConfigDeprecated",
  nwDotLikeOps = "DotLikeOps",
  nwSmallLshouldNotBeUsed = "SmallLshouldNotBeUsed",
  nwUnknownMagic = "UnknownMagic",
  nwRedefinitionOfLabel = "RedefinitionOfLabel",
  nwUnknownSubstitutionX = "UnknownSubstitutionX", nwBrokenLink = "BrokenLink",
  nwLanguageXNotSupported = "LanguageXNotSupported",
  nwFieldXNotSupported = "FieldXNotSupported", nwWarnRstStyle = "warnRstStyle",
  nwCommentXIgnored = "CommentXIgnored", nwTypelessParam = "TypelessParam",
  nwUseBase = "UseBase", nwWriteToForeignHeap = "WriteToForeignHeap",
  nwUnsafeCode = "UnsafeCode", nwUnusedImport = "UnusedImport",
  nwInheritFromException = "InheritFromException",
  nwEachIdentIsTuple = "EachIdentIsTuple", nwUnsafeSetLen = "UnsafeSetLen",
  nwUnsafeDefault = "UnsafeDefault", nwProveInit = "ProveInit",
  nwProveField = "ProveField", nwProveIndex = "ProveIndex",
  nwUnreachableElse = "UnreachableElse", nwUnreachableCode = "UnreachableCode",
  nwIndexCheck = "IndexCheck", nwGcUnsafe = "GcUnsafe",
  nwGcUnsafe2 = "GcUnsafe2", nwUninit = "Uninit", nwGcMem = "GcMem",
  nwDestructor = "Destructor", nwLockLevel = "LockLevel",
  nwResultShadowed = "ResultShadowed", nwSpacing = "Spacing",
  nwCaseTransition = "CaseTransition", nwCycleCreated = "CycleCreated",
  nwObservableStores = "ObservableStores", nwStrictNotNil = "StrictNotNil",
  nwResultUsed = "ResultUsed", nwCannotOpen = "CannotOpen",
  nwFileChanged = "FileChanged", nwEnumConv = "EnumConv",
  nwAnyEnumConv = "AnyEnumConv", nwHoleEnumConv = "HoleEnumConv",
  nwCStringConv = "CStringConv", nwEffect = "Effect", nwUser = "User"
  Source   Edit

Procs

func `$`(run: NimRun): string {....raises: [ValueError], tags: [].}
  Source   Edit
proc formatShellCmd(cmd: ShellCmd): ColoredText {....raises: [Exception],
    tags: [RootEffect].}
  Source   Edit
proc getCompileReportFor(file: AbsFile; dump: NimState; hints: bool = on): seq[
    NimReport] {....raises: [IOError, OSError, Exception, ValueError, ParseError,
                          LexcastError, ArgumentError, ShellError,
                          UnexpectedKindError, NilArgumentError, JsonError], tags: [
    ReadIOEffect, RootEffect, ReadEnvEffect, WriteIOEffect, WriteDirEffect,
    ReadDirEffect, ShellExecEffect, ExecIOEffect].}
  Source   Edit
proc getCwdNimDump(file: string = "-"): NimState {....raises: [IOError, OSError,
    JsonParsingError, ValueError, Exception, ArgumentError, ShellError, KeyError], tags: [
    ReadIOEffect, WriteIOEffect, ShellExecEffect, ExecIOEffect, ReadEnvEffect,
    RootEffect].}
  Source   Edit
proc getJoinable(runs: seq[NimRun]): tuple[joinable, standalone: seq[NimRun]] {.
    ...raises: [], tags: [].}
  Source   Edit
proc logLines(l: HLogger; part: NimReportPart) {.
    ...raises: [NilArgumentError, ValueError, IOError, KeyError],
    tags: [ReadEnvEffect, WriteIOEffect, ReadIOEffect].}
  Source   Edit
proc makeJoinedCode(runs: seq[NimRun]): string {....raises: [ValueError], tags: [].}
  Source   Edit
proc parseAmbiguousCall(text: string): NimReport {....raises: [IOError, OSError,
    UnexpectedCharError, NilArgumentError, Exception, ValueError],
    tags: [ReadIOEffect].}
  Source   Edit
proc parseNimReport(report: string): NimReport {....raises: [IOError, OSError,
    UnexpectedKindError, NilArgumentError, Exception, JsonError, ValueError,
    ParseError], tags: [ReadIOEffect].}
  Source   Edit
proc parseSpec(spec: string; file: AbsFile; skipFiles: seq[AbsFile] = @[]): NimTestSpec {....raises: [
    IOError, OSError, Exception, ValueError, ParseError, LexcastError],
    tags: [ReadIOEffect, RootEffect, ReadEnvEffect, WriteIOEffect].}
  Source   Edit
proc reportError(l: HLogger; report: NimReport; dump: NimState;
                 state: NimReportState = NimReportState()) {....raises: [
    NilArgumentError, ValueError, IOError, KeyError, ImplementKindError,
    ImplementError, ArgumentError, Exception, NoneArgumentError],
    tags: [ReadEnvEffect, WriteIOEffect, ReadIOEffect, RootEffect].}
  Source   Edit
proc runFromFile(file: AbsFile): NimRun {....raises: [IOError, OSError, Exception,
    ValueError, ParseError, LexcastError],
    tags: [ReadIOEffect, RootEffect, ReadEnvEffect, WriteIOEffect].}
  Source   Edit
proc runsFromDir(dir: AbsDir; first: seq[AbsFile] = @[]): seq[NimRun] {....raises: [
    PathError, ValueError, OSError, IOError, Exception, ParseError, LexcastError], tags: [
    ReadDirEffect, ReadIOEffect, RootEffect, ReadEnvEffect, WriteIOEffect].}
  Source   Edit
proc runTestDir(dir: AbsDir; dump: NimState; maxfail: int = high(int);
                first: seq[AbsFile] = @[]; l: HLogger = newTermLogger();
                parseRun: bool = true; hints: bool = true): bool {....raises: [
    PathError, ValueError, OSError, IOError, Exception, ParseError,
    LexcastError, NilArgumentError, UnexpectedKindError, JsonError, KeyError,
    ImplementKindError, ImplementError, ArgumentError, NoneArgumentError,
    ShellError], tags: [ReadDirEffect, ReadIOEffect, RootEffect, ReadEnvEffect,
                        WriteIOEffect, WriteDirEffect, ShellExecEffect,
                        ExecIOEffect].}
  Source   Edit
proc skipFileLineCol(str: var PosStr): tuple[file: AbsFile, line, column: int] {....raises: [
    NilArgumentError, IOError, OSError, Exception, UnexpectedCharError,
    ValueError], tags: [ReadIOEffect].}
  Source   Edit
proc skipKindDeclaredIn(str: var PosStr): tuple[kind: string, file: AbsFile,
    line, column: int] {....raises: [IOError, OSError, UnexpectedCharError,
                                  NilArgumentError, Exception, ValueError],
                         tags: [ReadIOEffect].}
  Source   Edit
proc skipKinds(reports: sink seq[NimReport];
               kind: set[NimReportKind] = {nrHint, nrWarning}): seq[NimReport] {.
    ...raises: [], tags: [].}
  Source   Edit

Exports

HLogEvent, runShell, traceImpl, errImpl, execShell, dumpImpl, loggerErrConverter, separator0, closeScope, fail, execCode, HLogScopeKind, HLogScope, failImpl, doneImpl, thisScope, warn, logImpl, HLogger, execShell, log, wait, err, prepareDump, runShell, prepareText, withPositions, fatal, ?, runShellResult, loggerField, indented, indent, format, infoImpl, HLogLevel, writeln, success, changeDir, pdump, warnImpl, waitImpl, findLineRange, separator1, prettyShellCmd, debugImpl, indentLen, trace, logScope, passImpl, linesAround, debug, info, typedArgs, waitFor, runShellResult, logStackTrace, done, skipNl, successImpl, fatalImpl, preparePDump, write, logLines, enableInScopeIf, notice, noticeImpl, dump, loggerOutConverter, log, initLogScope, lineTextAround, newTermLogger, dedent, openScope, logLines, openScope, withNewDir, exists, symlinkExists, getTempDir, isAbsolute, ==, listAll, joinPath, hash, PathError, get, addFileExt, $, dir, newWriteStream, getPermissions, parentDirs, getAppTempDir, cd, AltSep, exists, getAbsDir, PathErrorKind, dropSuffix, getFileInfo, getLastModificationTime, ==, withoutParent, getNewTempDir, paramStrs, contains, **, endsWith, getFilePermissions, AnyDir, createSymlink, withoutRoot, splitPath, getCurrentOs, joinPath, /../, withCleanDir, findFile, walkDir, toFsDir, toDll, cwd, withoutBasePrefix, normalizedPath, toFsEntry, parentDir, ShellExpr, absolute, exclFilePermissions, expandSymlink, del, createHardlink, getAppBasename, FsEntry, copyFileWithPermissions, AbsPath, dir, RelDir, initOptParser, getMissingDependencies, RelFile, set, normalizePathEnd, toFsTree, getAppCacheDir, inclFilePermissions, expandSymlink, getCreationTime, fileExists, newFileStream, cmkd, /, AnyPath, /, EnvVarError, fsEntryExists, toFsFileSeq, writeTempFile, ignorePathErrors, name, open, exists, mkWithDirStructure, /, $, cpDir, flatFiles, withTempDir, &&, getCurrentDir, DistributionDebianDerivatives, withTempDir, ShellVar, getUserCacheDir, *!, changeFileExt, parentDir, getFileInfo, listFiles, ext, withParent, paramVal, isValidFilename, paramVal, copyDirWithPermissions, toFsFile, lastPathPart, name, hasExt, startsWith, getAppTempFile, toFsDirOption, newOutStringStream, &&=, exists, getopt, withDir, writeFile, getStr, assertValid, toAbsDir, remainingArgs, getUserRuntimeDir, contains, toFsFileOption, rmDir, parseJson, AbsDir, splitCmdLine, ==, toFsDir, withoutParent, splitCmdLine, ensureDir, getCurrentCompilerExe, RelPath, getAppConfRc, cbackend, isHidden, getUserConfigDir, DirSep, parseFsDir, withTempDir, AbsFile, len, getAppDataDir, cpFile, cmpPaths, toFsFileSeq, &&, rmFile, splitFile, normalizedPath, <, splitFile, currentSourceDir, withNewStreamFile, getOsPackageManagerCmd, getEnv, put, getAppDir, normalizedPath, withBasePrefix, setLastModificationTime, FsDir, joinPath, <, mkDir, dir, buildFsTree, existsEnvTo, withEnv, getInstallCmd, OutStringStream, FsTree, extractFilename, listDirs, toFsEntry, joinPath, getFileSize, assertExists, getHomeDir, ShellVarType, FsFile, mkDirStructure, writeNewFile, splitDir, cmdLineRest, $$, searchExtPos, CmdLineKind, withBaseSuffix, &&, walkDir, isAbsolute, get, OptParser, withoutPrefix, hshow, importSplit, withoutExt, mvDir, splitDir, toFsDir, findExe, withStreamFile, withExt, ==, currentAbsSourceDir, toFsFile, existsOrCreateDir, AnyFile, existsEnvOrDefault, sameFile, ~, shellHaxOn, joinPath, setFilePermissions, toFsFile, delEnv, toAbsFile, dir, pathLen, getFileInfo, <, normalizedPath, toBool, relativeUpCount, startsWith, getInstalledPackagesCmd, parentDir, ~&, realpath, dirExists, getTempFile, newFileSearchError, splitFile2, addToBasename, &., splitFile2, putEnv, hasExt, walkDirRec, readFile, addFileExt, getLastAccessTime, parseFsFile, fileNewer, absolute, normalize, ParDir, getAppConfigDir, /., dir, CurDir, tailDir, getPermissions, changeFileExt, next, toExe, newPathError, getAppRuntimeDir, getAppFilename, toFsEntry, findFilesWithExt, joinPath, osAndNims, PathSep, toFsDirOption, joinPath, setEnv, parentDir, withBase, normalizePath, addExt, exists, ExeExts, getopt, toFsDirSeq, isRelative, relativePath, withoutNParents, rmFiles, sameDir, nameExt, detectOs, getConfigDir, /../, assertExists, relativePath, toJson, getStr, withTempFile, withExt, isPackageInstalled, startsWith, realpath, DistributionGenericOsNames, paramCount, toFsFileOption, toFsDirSeq, normalize, dir, appendFile, findFile, getUserDataDir, existsEnv, paramStr, mvFile, withExt, newParseError, last, mget, withMutIt, intersect, currentSourceDir, clampIdx, dowhile, inFor, getHax, mapEnum, newImplementBaseError, toRevMapArray, of, asExpr, assertArg, -, twoPassSortByIt, nor, clear, lit3, startHaxComp, findIt, Utf8Continuations, mq, dollar, asVar, canImport, prepareMsg, tern, newImplementKindError, mkind, newSetterError, echove, &, stopHaxComp, toMapArray, postInc, Utf8Starts, @, dieHereComp, kindToStr, toString, mblock, add, getOr, workHaxComp, workHax, assertOption, preInc, echov, inFor, sortIt, Utf8Any, pushHax, ?, toMapArray, sweepGroupByIt, getOr, GetterError, d, //, toArrayKeys, globalTick, assertRefFields, lit3, Utf8Starts4, CodeError, cblock, top, mq1, assertRef, LogicError, msep, raiseImplementError, dieHereMacro, ///, Utf8Starts3, of, mexpected, ?, ifHaxComp, ImplementKindError, pairs, NilArgumentError, asRef, stopHax, byaddr1, getClamped, empty, newLogicError, first, haxRunningComp, namedItemListing, madd, echoi, newUnexpectedKindError, &, assertKind, EnvironmentAssertionError, ParseError, getIt, toMapArray, toT, newUnexpectedKindError, newHException, assertHasIdx, toValSet, haxThis, asRef, withResIt, echoi, groupByIt, mergeUniqByIt, toMapArraySome, asPtr, newImplementError, asSet, takesOnlyMutable, SliceTypes, haxRunning, joinWords, mfound, dev, cexpr, and, getSomeIt, currIInfo, eachIt, ErrorAnnotation, procIt, IndexTypes, SetterError, nand, last, dumpTyped, Attr, printCpuTime, mitem, setKind, UnexpectedKindError, withIt, width, de, mfound, GlobalSubstring, clear, newGetterError, ?, endFor, last2, Utf8Starts2, haxc, @, mgetOrDefault, startHax, dieHere, importx, canGet, ImplementBaseError, newIt, curIDir, not, plog, dechofmt, deduplicateIt, &=, clamp, getHaxStack, inWhile, colorPrint, ImplementError, add, mwrap, setIt, here, expectType, notNil, getIt, startFor, getOr, withDeepIt, popHax, pop, subnodesEq, joinAnyOf, newArgumentError, clamp, globalTick, procIt, or, relToSource, InstantiationInfo, asSet, toSet, NoneArgumentError, mcode, toKeySet, toValSeq, logicAssert, newEnvironmentAssertionError, NoValue, add, isMutable, first, ArgumentError, asConst, asRef, debugechoi, add, It, toPluralNoun, ploc