Sha256: 77dea23c78208a671ad90b5257e7a12504d854a30aae19ff959d77bb87953e8f
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
# -*- coding: utf-8 -*- # # @file # @brief # @author ongaeshi # @date 2011/12/03 require 'milkode/cli.rb' require 'test_helper' require 'milkode_test_work' class TestCLI_Cdstk < Test::Unit::TestCase def setup $stdout = StringIO.new @first_default_dir = Dbdir.default_dir @work = MilkodeTestWork.new({:default_db => true}) @work.add_package "db1", @work.expand_path("../data/a_project") @orig_stdout = $stdout end def teardown $stdout = @orig_stdout @work.teardown end def test_grep command("grep") command("grep not_found") command("grep require -a") end def test_mcd assert_match /mcd/, command("mcd") end def test_info assert_match /.*packages.*records/, command("info") end def test_setdb_no_arg_disp assert_equal @work.expand_path("db1") + "\n", command("setdb") end def test_setdb_milkode_db_dir_rewrite open(@work.path(".milkode_db_dir"), "w") {|f| f.print "/a/custom/db" } assert_equal "/a/custom/db\n", command("setdb") end def test_setdb_error_not_database_dir assert_match(/fatal:/, command("setdb /a/write/test")) end def test_setdb_change @work.init_db("db2") assert_match "Set default db", command("setdb #{@work.path "db2"}") end def test_setdb_reset assert_not_equal @first_default_dir, Dbdir.default_dir command("setdb --reset") assert_equal @first_default_dir, Dbdir.default_dir end # def test_list_help # command("init -h") # command("add -h") # command("update -h") # command("remove -h") # command("list -h") # command("pwd -h") # command("cleanup -h") # command("rebuild -h") # command("dump -h") # command("dir -h") # command("setdb -h") # command("mcd -h") # command("info -h") # command("ignore -h") # command("web -h") # command("grep -h") # end private def command(arg) CLI.start(arg.split) $stdout.string end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
milkode-0.7.0 | test/test_cli.rb |