Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
92 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
|
||
Yast.import "SnapperDbus" | ||
|
||
describe "SnapperDbus" do | ||
describe "#escape" do | ||
it "call with nothing special" do | ||
expect(Yast::SnapperDbus.send(:escape, "hello")).to eq("hello") | ||
end | ||
|
||
|
||
it "call with UTF-8" do | ||
expect(Yast::SnapperDbus.send(:escape, "schön")).to eq("sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT)) | ||
end | ||
|
||
|
||
it "call with slash" do | ||
expect(Yast::SnapperDbus.send(:escape, "\\")).to eq("\\\\") | ||
end | ||
|
||
|
||
it "call with a hash" do | ||
expect(Yast::SnapperDbus.send(:escape, { "schön" => "hier" })) | ||
.to eq({ "sch\\xc3\\xb6n".force_encoding(Encoding::ASCII_8BIT) => "hier" }) | ||
end | ||
end | ||
|
||
describe "#unescape" do | ||
it "call with nothing special" do | ||
expect(Yast::SnapperDbus.send(:unescape, "hello")).to eq("hello") | ||
expect(Yast::SnapperDbus.send(:unescape, "world").encoding).to eq(Encoding::ASCII_8BIT) | ||
end | ||
|
||
|
||
it "call with escaped UTF-8" do | ||
expect(Yast::SnapperDbus.send(:unescape, "sch\\xc3\\xb6n")).to eq("schön".force_encoding(Encoding::ASCII_8BIT)) | ||
end | ||
|
||
it "call with slash" do | ||
expect(Yast::SnapperDbus.send(:unescape, "\\\\")).to eq("\\") | ||
end | ||
|
||
it "call with a hash" do | ||
expect(Yast::SnapperDbus.send(:unescape, { "sch\\xc3\\xb6n" => "hier" })) | ||
.to eq({ "schön".force_encoding(Encoding::ASCII_8BIT) => "hier" }) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env rspec | ||
|
||
require_relative "test_helper" | ||
|
||
Yast.import "Snapper" | ||
|
||
describe Yast::Snapper do | ||
describe "#userdata_to_string" do | ||
it "call with empty userdata" do | ||
expect(Yast::Snapper.userdata_to_string({ })).to eq("") | ||
end | ||
|
||
it "call with simple userdata" do | ||
expect(Yast::Snapper.userdata_to_string({ "hello" => "world" })).to eq("hello=world") | ||
end | ||
|
||
it "call with complex userdata" do | ||
expect(Yast::Snapper.userdata_to_string({ "a" => "1", "b" => "2" })).to eq("a=1, b=2") | ||
end | ||
end | ||
|
||
describe "#string_to_userdata" do | ||
it "call with empty string" do | ||
expect(Yast::Snapper.string_to_userdata("")).to eq({ }) | ||
end | ||
|
||
it "call with simple string" do | ||
expect(Yast::Snapper.string_to_userdata("hello=world")).to eq({ "hello" => "world" }) | ||
end | ||
|
||
it "call with complex string" do | ||
expect(Yast::Snapper.string_to_userdata("a=1,b=2")).to eq({ "a" => "1", "b" => "2" }) | ||
end | ||
|
||
it "call with complex string and space after comma" do | ||
expect(Yast::Snapper.string_to_userdata("a=1, b=2")).to eq({ "a" => "1", "b" => "2" }) | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.