Generate the source and test skeleton

This commit is contained in:
mratsim 2018-03-20 18:59:42 +01:00
parent 456057a8d6
commit 5ef613d5af

View File

@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.
import cligen,
os, strutils, tables,
os, strutils, tables, strformat,
./private/[datatypes, error_checking, cligen_extensions, format],
./licensing/license,
./skeleton/[projectNimble, readme]
@ -111,6 +111,32 @@ proc nimbus_launch(projectName: string,
genReadme(projectName, githubName, nimbleName, licenses)
)
# 8. Add the source and test skeleton
writeFile(
prjDir & "/src/" & nimbleName & ".nim",
licenseHeader
)
var testString = licenseHeader
testString &= &"""
import unittest,
../src/{nimbleName}
suite "Your first test suite":
test "Your first test":
block: # independant block of subtest
discard
block:
discard
"""
writeFile(
prjDir & "/tests/all_tests.nim",
testString
)
when isMainModule:
dispatch nimbus_launch