Skip to content

Commit

Permalink
add spec/score/order_spec.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
wtsnjp committed Aug 13, 2024
1 parent c09bb59 commit cb22b6c
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions spec/score/order_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'spec_helper'

RSpec.describe "Document order in the result", :type => :aruba do
include_context "messages"
include_context "texmf"

context "for documents with different scores" do
before(:each) { run_texdoc "-lM", "babel" }

let(:res_list_head) do
<<~EXPECTED
babel\t7.0\t#{normalize_path(texmf_dist / "doc/latex/babel/babel.pdf")}\t\tUser guide
babel\t4.0\t#{normalize_path(texmf_dist / "doc/latex/babel/babel-code.pdf")}\t\tCode documentation
EXPECTED
end

it "should be ordered by the scores" do
expect(stdout).to start_with(res_list_head)
end
end

context "for documents with the same scores and different extentions" do
before(:each) { run_texdoc "-lM", "texlive-en" }

let(:res_list_head) do
<<~EXPECTED
texlive-en\t10.0\t#{normalize_path(texmf_dist / "doc/texlive/texlive-en/texlive-en.pdf")}\t\t
texlive-en\t10.0\t#{normalize_path(texmf_dist / "doc/texlive/texlive-en/texlive-en.html")}\t\t
EXPECTED
end

it "should be ordered by the extention position" do
expect(stdout).to start_with(res_list_head)
end
end
end
2 changes: 1 addition & 1 deletion spec/support/shared_contexts/texmf_context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:ps_texmf_dist) { SpecHelplers::Texdoc::PS_TEXMF_DIST }

# the only real TEXMF tree
let(:texmf_dist) { `kpsewhich --var-value TEXMFDIST`.chomp }
let(:texmf_dist) { Pathname(`kpsewhich --var-value TEXMFDIST`.chomp) }

# link to texlive.tlpdb
let(:ps_tlpdb) { SpecHelplers::Texdoc::REPO_TEXLIVE_TLPDB }
Expand Down

0 comments on commit cb22b6c

Please sign in to comment.