Skip to content

Commit

Permalink
RSpec for IsEmpty
Browse files Browse the repository at this point in the history
uphold the test coverage
  • Loading branch information
mvidner committed Dec 5, 2017
1 parent cfc3e8d commit 80a350e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 31 deletions.
6 changes: 4 additions & 2 deletions library/types/test/Makefile.am
@@ -1,9 +1,11 @@
TESTS = \
hostname_test.rb \
ip_test.rb \
ipv4_netmask_test.rb \
hostname_test.rb \
string_test.rb \
type_repository_test.rb \
url_test.rb \
string_test.rb
urlrecode_test.rb

TEST_EXTENSIONS = .rb
RB_LOG_COMPILER = rspec
Expand Down
28 changes: 28 additions & 0 deletions library/types/test/type_repository_test.rb
@@ -0,0 +1,28 @@
#!/usr/bin/env rspec

require_relative "test_helper"

Yast.import "TypeRepository"

describe Yast::TypeRepository do
describe "#IsEmpty" do
it "returns true for nil and the empty String, Array, Hash, Term" do
expect(Yast::TypeRepository.IsEmpty(nil)).to eq(true)
expect(Yast::TypeRepository.IsEmpty("")).to eq(true)
expect(Yast::TypeRepository.IsEmpty([])).to eq(true)
expect(Yast::TypeRepository.IsEmpty({})).to eq(true)
expect(Yast::TypeRepository.IsEmpty(HBox())).to eq(true)
end

it "returns false otherwise" do
expect(Yast::TypeRepository.IsEmpty(0)).to eq(false)
expect(Yast::TypeRepository.IsEmpty(0.0)).to eq(false)
expect(Yast::TypeRepository.IsEmpty("item")).to eq(false)
expect(Yast::TypeRepository.IsEmpty(["item"])).to eq(false)
expect(Yast::TypeRepository.IsEmpty("dummy" => "item")).to eq(false)
expect(Yast::TypeRepository.IsEmpty(HBox(Label()))).to eq(false)
expect(Yast::TypeRepository.IsEmpty(false)).to eq(false)
expect(Yast::TypeRepository.IsEmpty(true)).to eq(false)
end
end
end
Empty file.
Empty file.
29 changes: 0 additions & 29 deletions library/types/testsuite/tests/isempty.rb

This file was deleted.

0 comments on commit 80a350e

Please sign in to comment.