1 # frozen_string_literal: true
2 require_relative 'helper'
4 class TestRDocGeneratorPOT < RDoc::TestCase
9 @options = RDoc::Options.new
10 @tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_pot_#{$$}"
11 FileUtils.mkdir_p @tmpdir
13 @generator = RDoc::Generator::POT.new @store, @options
15 @top_level = @store.add_file 'file.rb'
16 @klass = @top_level.add_class RDoc::NormalClass, 'Object'
17 @klass.add_comment 'This is a class', @top_level
18 @klass.add_section 'This is a section', comment('This is a section comment')
20 @const = RDoc::Constant.new "CONSTANT", "29", "This is a constant"
22 @meth = RDoc::AnyMethod.new nil, 'method'
23 @meth.record_location @top_level
24 @meth.comment = 'This is a method'
26 @attr = RDoc::Attr.new nil, 'attr', 'RW', ''
27 @attr.record_location @top_level
28 @attr.comment = 'This is an attribute'
30 @klass.add_constant @const
31 @klass.add_method @meth
32 @klass.add_attribute @attr
41 FileUtils.rm_rf @tmpdir
47 assert_equal <<-POT, File.read(File.join(@tmpdir, 'rdoc.pot'))
48 # SOME DESCRIPTIVE TITLE.
49 # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
50 # This file is distributed under the same license as the PACKAGE package.
51 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
55 "Project-Id-Version: PACKAGE VERSEION\\n"
56 "Report-Msgid-Bugs-To:\\n"
57 "PO-Revision-Date: YEAR-MO_DA HO:MI+ZONE\\n"
58 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\\n"
59 "Language-Team: LANGUAGE <LL@li.org>\\n"
61 "MIME-Version: 1.0\\n"
62 "Content-Type: text/plain; charset=CHARSET\\n"
63 "Content-Transfer-Encoding: 8bit\\n"
64 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\\n"
67 msgid "This is a class"
71 msgid "This is a constant"
75 msgid "This is a method"
78 #. Object: section title
79 msgid "This is a section"
82 #. Object: This is a section
83 msgid "This is a section comment"
87 msgid "This is an attribute"