Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tasks: add tests for PR #912 #914

Merged
merged 1 commit into from
Apr 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions tests/tasks/empty/tasks.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Package

version = "0.1.0"
author = "David Anes <kraptor>"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["run"]


# Dependencies

requires "nim >= 0.19.0"
23 changes: 23 additions & 0 deletions tests/tasks/max/tasks.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Package

version = "0.1.0"
author = "David Anes <kraptor>"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["run"]


# Dependencies

requires "nim >= 0.19.0"


task task1, "Description1":
echo "blah"

task very_long_task, "This is a task with a long name":
echo "blah"

task aaa, "A task with a small name":
echo "blah"
17 changes: 17 additions & 0 deletions tests/tasks/min/tasks.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Package

version = "0.1.0"
author = "David Anes <kraptor>"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["run"]


# Dependencies

requires "nim >= 0.19.0"


task a, "Description for a":
echo "blah blah"
17 changes: 17 additions & 0 deletions tests/tasks/nodesc/tasks.nimble
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Package

version = "0.1.0"
author = "David Anes <kraptor>"
description = "A new awesome nimble package"
license = "MIT"
srcDir = "src"
bin = @["run"]


# Dependencies

requires "nim >= 0.19.0"


task nodesc, "":
echo "A task with no description"
26 changes: 26 additions & 0 deletions tests/tester.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1283,3 +1283,29 @@ suite "issues":
let lines = output.strip.processOutput()
check exitCode != QuitSuccess
check inLines(lines, "Nothing to build")

suite "nimble tasks":
test "can list tasks even with no tasks defined in nimble file":
cd "tasks/empty":
let (_, exitCode) = execNimble("tasks")
check exitCode == QuitSuccess

test "tasks with no descriptions are correctly displayed":
cd "tasks/nodesc":
let (output, exitCode) = execNimble("tasks")
check output.contains("nodesc")
check exitCode == QuitSuccess

test "task descriptions are correctly aligned to longer name":
cd "tasks/max":
let (output, exitCode) = execNimble("tasks")
check output.contains("task1 Description1")
check output.contains("very_long_task This is a task with a long name")
check output.contains("aaa A task with a small name")
check exitCode == QuitSuccess

test "task descriptions are correctly aligned to minimum (10 chars)":
cd "tasks/min":
let (output, exitCode) = execNimble("tasks")
check output.contains("a Description for a")
check exitCode == QuitSuccess