Skip to content

Commit

Permalink
More docs and more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Sep 15, 2021
1 parent 05ff448 commit 7565f78
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
6 changes: 6 additions & 0 deletions library/system/src/lib/yast2/shared_lib_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ module Yast
# /proc/$pid/maps file.
#
# For testing, a fixed file can be used.
#
# The information stored in this class is only a snapshot in the life time of
# the process. As new shared libs are loaded (e.g. plug-ins are loaded with
# dlopen()), this information may become outdated. In that case, simply let
# the old instance go out of scope and create a new one.
#
class SharedLibInfo
# @return [Array<String>] Complete paths of the shared libs
attr_reader :shared_libs
Expand Down
6 changes: 6 additions & 0 deletions library/system/src/lib/yast2/ui_plugin_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ module Yast
# /proc/$pid/maps file.
#
# For testing, a fixed file can be used.
#
# The information stored in this class is only a snapshot in the life time of
# the process. As new shared libs are loaded (e.g. plug-ins are loaded with
# dlopen()), this information may become outdated. In that case, simply let
# the old instance go out of scope and create a new one.
#
class UiPluginInfo < SharedLibInfo
include Yast::Logger

Expand Down
10 changes: 10 additions & 0 deletions library/system/test/shared_lib_info_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,14 @@ def stored_proc_maps(scenario)
expect(described_class.so_number("/usr/lib64/libc-2.33.so")).to eq nil
end
end

describe "#build_lib_name" do
it "correctly builds a UI plug-in name" do
expect(described_class.build_lib_name("libyui-qt-pkg", "15.0.0")).to eq "libyui-qt-pkg.so.15.0.0"
end

it "correctly builds a libc path without a SO number" do
expect(described_class.build_lib_name("libc-2.33", nil)).to eq "libc-2.33.so"
end
end
end

0 comments on commit 7565f78

Please sign in to comment.