Skip to content
Browse files

add tests for cli interface

  • Loading branch information...
1 parent 2d3325b commit 6991149d2414b42d2ac5c58d9c357509e0e159d2 @grosser committed Sep 17, 2011
Showing with 4 additions and 2 deletions.
  1. +2 −2 bin/language_sniffer
  2. +2 −0 test/test_cli.rb
View
4 bin/language_sniffer
@@ -2,10 +2,10 @@
require 'language_sniffer/file_blob'
-path = ARGV[0] || Dir.pwd
+path = ARGV[0] || ''
if File.directory?(path)
- raise "Cannot parse a whole directory"
+ abort "Cannot parse a whole directory"
elsif File.file?(path)
blob = LanguageSniffer::FileBlob.new(path, Dir.pwd)
View
2 test/test_cli.rb
@@ -3,5 +3,7 @@
class TestBlob < Test::Unit::TestCase
def test_cli
assert_equal "test/fixtures/bar.h: 11 lines (7 sloc)\n extension: .h\n language: C++\n", `bundle exec ruby bin/language_sniffer test/fixtures/bar.h`
+ assert_equal "usage: language_sniffer <file>\n", `bundle exec ruby bin/language_sniffer 2>&1`
+ assert_equal "Cannot parse a whole directory\n", `bundle exec ruby bin/language_sniffer lib 2>&1`
end
end

0 comments on commit 6991149

Please sign in to comment.
Something went wrong with that request. Please try again.