Cowsay.jl/test/runtests.jl

29 lines
967 B
Julia
Raw Normal View History

2021-09-23 14:14:08 +00:00
using Cowsay
using Test
using Documenter
DocMeta.setdocmeta!(Cowsay, :DocTestSetup, :(using Cowsay); recursive=true)
2022-02-01 21:42:15 +00:00
2022-02-01 22:11:03 +00:00
@testset "cowsay" begin
2022-02-01 21:42:15 +00:00
@testset "Doctests" begin
doctest(Cowsay)
end
@testset "Balloon Formation" begin
# One-liner say balloon
@test Cowsay.sayballoon("One line") == " __________\n< One line >\n ----------\n"
# Two-liner say balloon
@test Cowsay.sayballoon("One line\nTwo line") == " __________\n/ One line \\\n\\ Two line /\n ----------\n"
# Multi-liner say balloon
@test Cowsay.sayballoon("One line\nTwo line\nRed line\nBlue line") == " ___________\n/ One line \\\n| Two line |\n| Red line |\n\\ Blue line /\n -----------\n"
end
@testset "IO Funkiness" begin
# Cowsay with io redirection
@test_warn cowsaid("Moo") cowsay(stderr, "Moo")
# Cowthink with io redirection
@test_warn cowthunk("Moo") cowthink(stderr, "Moo")
end
2022-02-01 21:42:15 +00:00
end