Skip to content

Instantly share code, notes, and snippets.

@bcomnes
Created July 22, 2014 17:44
Show Gist options
  • Save bcomnes/6581c3b27b9061583b48 to your computer and use it in GitHub Desktop.
Save bcomnes/6581c3b27b9061583b48 to your computer and use it in GitHub Desktop.
Trying to write tests for xylib
arc-mac-04:samples bcomnes$ echo "20.0 490.5" > test.txt
arc-mac-04:samples bcomnes$ cat test.txt
20.0 490.5
arc-mac-04:samples bcomnes$ xyconv -g test.txt
text: ascii text
brew test xylib --verbose --debug
/Users/bcomnes/homebrew/Library/brew.rb (Formulary::StandardLoader): loading /Users/bcomnes/homebrew/Library/Taps/homebrew/homebrew-science/xylib.rb
Testing xylib
==> /Users/bcomnes/homebrew/Cellar/xylib/1.3/bin/xyconv --version
1.3.0
==> /Users/bcomnes/homebrew/Cellar/xylib/1.3/bin/xyconv -g /private/tmp/xylib-mjAY/with_sigma.txt
Usage:
xyconv [-t FILETYPE] [-x OPTION] INPUT_FILE OUTPUT_FILE
xyconv [-t FILETYPE] [-x OPTION] -m INPUT_FILE1 ...
xyconv -i FILETYPE
xyconv -g INPUT_FILE ...
xyconv [-l|-v|-h]
Converts INPUT_FILE to ascii OUTPUT_FILE
-t specify filetype of input file
-x specify option for filetype (can be used more than once)
-m convert one or multiple files; output files have the same name
as input, but with extension changed to .xy
-l list all supported file types
-v output version information and exit
-h show this help message and exit
-i show information about filetype
-s do not output metadata
-g guess filetype of file
To write the results to standard output use `-' as OUTPUT_FILE
Error: xylib: failed
Failed executing: /Users/bcomnes/homebrew/Cellar/xylib/1.3/bin/xyconv -g\ /private/tmp/xylib-mjAY/with_sigma.txt
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:560:in `system'
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:544:in `open'
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:544:in `system'
/Users/bcomnes/homebrew/Library/Taps/homebrew/homebrew-science/xylib.rb:22
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:487:in `instance_eval'
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:487:in `test'
/Users/bcomnes/homebrew/Library/Homebrew/extend/fileutils.rb:21:in `mktemp'
/Users/bcomnes/homebrew/Library/Homebrew/formula.rb:485:in `test'
/Users/bcomnes/homebrew/Library/Homebrew/cmd/test.rb:54:in `test'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/timeout.rb:67:in `timeout'
/Users/bcomnes/homebrew/Library/Homebrew/cmd/test.rb:53:in `test'
/Users/bcomnes/homebrew/Library/Homebrew/cmd/test.rb:34:in `each'
/Users/bcomnes/homebrew/Library/Homebrew/cmd/test.rb:34:in `test'
/Users/bcomnes/homebrew/Library/brew.rb:131:in `send'
/Users/bcomnes/homebrew/Library/brew.rb:131
require "formula"
class Xylib < Formula
homepage "http://xylib.sourceforge.net"
url "https://github.com/wojdyr/xylib/releases/download/v1.3/xylib-1.3.tar.bz2"
sha1 "61d95a9d3c98239fd4fb335fadadd85be3001a89"
depends_on "boost" => :build
depends_on "zlib" => :recommended
def install
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
system bin/"xyconv", "--version"
(testpath/'with_sigma.txt').write('20.0 490.5')
system "#{bin}/xyconv", "-g\ #{testpath}/with_sigma.txt"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment