libfaketime: add test

Closes #29446.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
Xiao Di Guan 2018-06-26 23:49:38 +10:00 committed by FX Coudert
parent 17a2b7184d
commit 629d3daa55

View file

@ -17,7 +17,7 @@ class Libfaketime < Formula
# https://github.com/Homebrew/homebrew-core/issues/26568
depends_on "coreutils"
depends_on :macos => :lion
depends_on :macos => :sierra
def install
system "make", "-C", "src", "-f", "Makefile.OSX", "PREFIX=#{prefix}"
@ -25,4 +25,9 @@ class Libfaketime < Formula
(lib/"faketime").install "src/libfaketime.1.dylib"
man1.install "man/faketime.1"
end
test do
cp "/bin/date", testpath/"date" # Work around SIP.
assert_match "1230106542", shell_output(%Q(TZ=UTC #{bin}/faketime -f "2008-12-24 08:15:42" #{testpath}/date +%s)).strip
end
end