Skip to content

Commit

Permalink
extend test for localized sections
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 22, 2016
1 parent 728be69 commit 9da9bb2
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/sections_test.rb
Expand Up @@ -3,6 +3,7 @@
require_relative "./test_helper"

require "bootloader/sections"
require "cfa/memory_file"

describe Bootloader::Sections do
subject do
Expand Down Expand Up @@ -50,6 +51,25 @@

expect(subject.default).to eq "windows"
end

it "raises exception if section do not exists" do
expect{subject.default = "non-exist"}.to raise_error(RuntimeError)
end

it "handle localized grub.cfg" do
data_path = File.expand_path("../data/grub.cfg", __FILE__)
file = CFA::MemoryFile.new(File.read(data_path))
grub_cfg = CFA::Grub2::GrubCfg.new(file_handler: file)
grub_cfg.load

sections = Bootloader::Sections.new(grub_cfg)

puts sections.all.inspect

expect{sections.default = "openSUSE Tumbleweed, с Linux 4.8.6-2-default"}.to_not raise_error
expect{sections.default = "openSUSE Tumbleweed, \u0441 Linux 4.8.6-2-default"}.to_not raise_error
expect{sections.default = "openSUSE Tumbleweed, \xD1\x81 Linux 4.8.6-2-default"}.to_not raise_error
end
end

describe "#write" do
Expand Down

0 comments on commit 9da9bb2

Please sign in to comment.