comparison old_tests/test_resources.nim @ 1203:6360c8d17ce0 compiletime-tests

did: preprations to add rendering tests
author sam <sam@basx.dev>
date Mon, 15 Jul 2024 20:06:42 +0700
parents tests/test_resources.nim@114f395b9144
children
comparison
equal deleted inserted replaced
1202:a8864fe6fe6e 1203:6360c8d17ce0
1 import std/os
2 import std/streams
3 import std/strformat
4 import std/strutils
5
6 import semicongine
7
8 proc list_all_mods_all_files() =
9 for package in Packages():
10 echo &"Files in package {package}:"
11 for i in WalkResources(package = package):
12 echo " ", i, ": ", i.LoadResource(package = package).readAll().len
13
14 proc print_ls(dir, package: string, indent = 2) =
15 for i in dir.List(package = package):
16 if i.kind == pcDir:
17 echo "".align(indent), i.path, "/"
18 print_ls(dir.joinPath(i.path), package = package, indent = indent + 2)
19 else:
20 echo "".align(indent), i.path, ": ", dir.joinPath(i.path).LoadResource(package = package).readAll().len
21
22 proc list_files() =
23 for package in Packages():
24 echo &"Recursive walk of package {package}: "
25 print_ls("", package = package)
26
27
28 proc main() =
29 echo "Packages available: ", Packages()
30 list_all_mods_all_files()
31 list_files()
32
33 when isMainModule:
34 main()