perl: convert to new stand-alone test process (#37727)
This commit is contained in:
parent
815b210fc8
commit
c34cd76f2a
@ -494,16 +494,19 @@ def command(self):
|
|||||||
msg = "Unable to locate {0} command in {1}"
|
msg = "Unable to locate {0} command in {1}"
|
||||||
raise RuntimeError(msg.format(self.spec.name, self.prefix.bin))
|
raise RuntimeError(msg.format(self.spec.name, self.prefix.bin))
|
||||||
|
|
||||||
def test(self):
|
def test_version(self):
|
||||||
"""Smoke tests"""
|
"""check version"""
|
||||||
exe = self.spec["perl"].command.name
|
perl = self.spec["perl"].command
|
||||||
|
out = perl("--version", output=str.split, error=str.split)
|
||||||
|
expected = ["perl", str(self.spec.version)]
|
||||||
|
for expect in expected:
|
||||||
|
assert expect in out
|
||||||
|
|
||||||
reason = "test: checking version is {0}".format(self.spec.version)
|
def test_hello(self):
|
||||||
self.run_test(
|
"""ensure perl runs hello world"""
|
||||||
exe, "--version", ["perl", str(self.spec.version)], installed=True, purpose=reason
|
|
||||||
)
|
|
||||||
|
|
||||||
reason = "test: ensuring perl runs"
|
|
||||||
msg = "Hello, World!"
|
msg = "Hello, World!"
|
||||||
options = ["-e", 'use warnings; use strict;\nprint("%s\n");' % msg]
|
options = ["-e", "use warnings; use strict;\nprint('%s\n');" % msg]
|
||||||
self.run_test(exe, options, msg, installed=True, purpose=reason)
|
|
||||||
|
perl = self.spec["perl"].command
|
||||||
|
out = perl(*options, output=str.split, error=str.split)
|
||||||
|
assert msg in out
|
||||||
|
Loading…
Reference in New Issue
Block a user