summary refs log tree commit diff stats
path: root/compiler/docgen.nim
Commit message (Collapse)AuthorAgeFilesLines
* big refactoring: step 1Araq2016-10-311-3/+3
|
* fixes #4913Andreas Rumpf2016-10-201generated by cgit-pink 1.4.1-2-gfad0 (git 2.36.2.497.gbbea4dcf42) at 2025-05-27 18:43:32 +0000 r: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
discard """
  output: '''true
true
true
true
true
true
true
true
true
All:
__really_obscure_dir_name/are.x
__really_obscure_dir_name/created
__really_obscure_dir_name/dirs
__really_obscure_dir_name/files.q
__really_obscure_dir_name/some
__really_obscure_dir_name/test
__really_obscure_dir_name/testing.r
__really_obscure_dir_name/these.txt
Files:
__really_obscure_dir_name/are.x
__really_obscure_dir_name/files.q
__really_obscure_dir_name/testing.r
__really_obscure_dir_name/these.txt
Dirs:
__really_obscure_dir_name/created
__really_obscure_dir_name/dirs
__really_obscure_dir_name/some
__really_obscure_dir_name/test
false
false
false
false
false
false
false
false
false
true
true
Raises
true
true
true
'''
"""
# test os path creation, iteration, and deletion

import os, strutils

let files = @["these.txt", "are.x", "testing.r", "files.q"]
let dirs = @["some", "created", "test", "dirs"]

let dname = "__really_obscure_dir_name"

createDir(dname)
echo dirExists(dname)

# Test creating files and dirs
for dir in dirs:
  createDir(dname/dir)
  echo dirExists(dname/dir)

for file in files:
  let fh = open(dname/file, fmReadWrite)
  fh.close()
  echo fileExists(dname/file)

echo "All:"

template norm(x): untyped =
  (when defined(windows): x.replace('\\', '/') else: x)

for path in walkPattern(dname/"*"):
  echo path.norm

echo "Files:"

for path in walkFiles(dname/"*"):
  echo path.norm

echo "Dirs:"

for path in walkDirs(dname/"*"):
  echo path.norm

# Test removal of files dirs
for dir in dirs:
  removeDir(dname/dir)
  echo dirExists(dname/dir)

for file in files:
  removeFile(dname/file)
  echo fileExists(dname/file)

removeDir(dname)
echo dirExists(dname)

# createDir should create recursive directories
createDir(dirs[0] / dirs[1])
echo dirExists(dirs[0] / dirs[1]) # true
removeDir(dirs[0])

# createDir should properly handle trailing separator
createDir(dname / "")
echo dirExists(dname) # true
removeDir(dname)

# createDir should raise IOError if the path exists
# and is not a directory
open(dname, fmWrite).close
try:
  createDir(dname)
except IOError:
  echo "Raises"
removeFile(dname)

# test copyDir:
createDir("a/b")
open("a/b/file.txt", fmWrite).close
createDir("a/b/c")
open("a/b/c/fileC.txt", fmWrite).close

copyDir("a", "../dest/a")
removeDir("a")

echo dirExists("../dest/a/b")
echo fileExists("../dest/a/b/file.txt")

echo fileExists("../dest/a/b/c/fileC.txt")
removeDir("../dest")
Splits index into documents and APIs.Grzegorz Adam Hankiewicz2014-04-211-2/+2 | * Adds documentation sections to the index.Grzegorz Adam Hankiewicz2014-04-211-0/+25 | * Adds explicit titles to documentation index.Grzegorz Adam Hankiewicz2014-04-211-2/+8 | * merged better html links #850Araq2014-04-081-9/+159 | * split the inline and closure iterators into different symbol kinds for ↵Zahary Karadjov2014-03-061-1/+1 | | | | easier discrimination between them * made 'koch web' work when current dir has a space in itAraq2014-02-151-2/+8 | * case consistency: cs:partial bootstraps on windowsAraq2013-12-291-2/+2 | * case consistency: next stepsAraq2013-12-291-5/+5 | * case consistency part 4Araq2013-12-271-12/+12 | * case consistency part 1Araq2013-12-271-10/+10 | * Added jsondoc compiler switchErik O'Leary2013-12-121-106/+178 | | | | Outputs top-level exported information in JSON * next steps for the new parser/grammarAraq2013-04-201-1/+1 | * first steps to the new parser/grammarAraq2013-04-191-1/+1 |