Sha256: 87e92ca8d386e45cdcde9402a0057b6fe24787f0a086dee8cb788862cd6a59c3

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 KB

Contents

require 'spec_helper'

describe "synopsis section" do
  
  before do
    @synopsis = SynopsisSection.new do |syno|
                  syno.option :r, "Some r flag"
                  syno.option :j, "Some j flag"
                  syno.option :k, "Some k flag"
                  syno.option :"0", "Some zero flag"
                  syno.option :A, "Some capitalized flag"
                  syno.option :Z, "some big-z flag"
                  syno.option :verbose, "The verbose flag does a lot of stuff."
                  syno.option :silliness, "Set how silly the application should be.", :argument => "n"
                  syno.option :input, "The input flag takes a filename", :argument => "<input>"
                end
    @groffed = @synopsis.to_groff
  end
  
  it "contains the name of the man page" do
    @groffed.should.match(/^\.Nm$/)
  end
  
  it "displays long-form flags" do
    @groffed.should.match(/^\.Op Fl verbose$/)
  end
  
  it "combines short-form flags into one entry" do
    @groffed.should.match(/^\.Op Fl ([rjk0AZ]{6})/)
  end
  
  it "sorts short-form flags within their entry" do
    @groffed.should.match(/AZjkr0/)
  end
  
  it "encodes < and > in option arguments" do
    @groffed.should.match(/Ao input Ac/)
  end
  
  it "underlines arguments" do
    @groffed.should.match(/\.Op Fl silliness Ar n/)
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rtfm-0.5.2 spec/synopsis_spec.rb
rtfm-0.5.1 spec/synopsis_spec.rb
rtfm-0.5.0 spec/synopsis_spec.rb