Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add test for optformat method
  • Loading branch information
jreidinger committed Feb 2, 2015
1 parent 34c5827 commit cef01fb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions library/types/test/string_test.rb
Expand Up @@ -345,4 +345,19 @@
expect(subject.ReplaceWith("abc", "d", nil)).to eq nil
end
end

describe ".OptFormat" do
it "returns sformated parameters, but it allows only one parameter" do

This comment has been minimized.

Copy link
@ancorgs

ancorgs Feb 10, 2015

Contributor

This proves that it returns sformated value, but does not prove that it allows only one parameter.

This comment has been minimized.

Copy link
@jreidinger

jreidinger Feb 10, 2015

Author Member

right, I add test case also for it.

This comment has been minimized.

Copy link
@jreidinger

jreidinger Feb 10, 2015

Author Member

it was removed in the end as it is private only method.

expect(subject.OptFormat("%1 a", 5)).to eq "5 a"
end

it "returns empty string if parameter is nil or empty" do
expect(subject.OptFormat("%1 a", nil)).to eq ""
expect(subject.OptFormat("%1 a", "")).to eq ""
end

it "returns nil if format string is nil" do
expect(subject.OptFormat(nil, 5)).to eq nil
end
end
end

0 comments on commit cef01fb

Please sign in to comment.