gettextpo 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (C) 2026 gemmaro
4
+ #
5
+ # This program is free software: you can redistribute it and/or modify
6
+ # it under the terms of the GNU General Public License as published by
7
+ # the Free Software Foundation, either version 3 of the License, or
8
+ # (at your option) any later version.
9
+ #
10
+ # This program is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
+ # GNU General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU General Public License
16
+ # along with this program. If not, see <https://www.gnu.org/licenses/>.
17
+
18
+ require_relative "test_helper"
19
+
20
+ class GettextPOTest < Test::Unit::TestCase
21
+ def load_tests(name)
22
+ path = File.join(__dir__, "../test/#{name}.rb")
23
+ instance_eval(File.read(path), path)
24
+ end
25
+
26
+ test 'common with mruby' do
27
+ %w[
28
+ check
29
+ file
30
+ filepos
31
+ format
32
+ header
33
+ message
34
+ message_iterator
35
+ version
36
+ ].each do |target|
37
+ load_tests(target)
38
+ end
39
+ end
40
+
41
+ def _create_message_and_drop_file
42
+ file = GettextPO::File.new
43
+ iterator = file.message_iterator
44
+ iterator.insert("msgid1", "msgstr1")
45
+ end
46
+
47
+ test "dangling pointer" do
48
+ message = _create_message_and_drop_file
49
+ GC.start(full_mark: true, immediate_sweep: true)
50
+ assert_equal "msgid1", message.msgid
51
+ end
52
+ end
@@ -0,0 +1 @@
1
+ a
@@ -0,0 +1,20 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Free Software Foundation, Inc.
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ #
5
+ #, fuzzy
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: PACKAGE VERSION\n"
9
+ "PO-Revision-Date: YEAR-MO-DA HO:MI +ZONE\n"
10
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
11
+ "Language-Team: LANGUAGE <LL@li.org>\n"
12
+ "MIME-Version: 1.0\n"
13
+ "Content-Type: text/plain; charset=UTF-8\n"
14
+ "Content-Transfer-Encoding: 8bit\n"
15
+
16
+ msgid "msgid1"
17
+ msgstr "msgstr1"
18
+
19
+ msgid "msgid1"
20
+ msgstr "msgstr1"
@@ -0,0 +1,3 @@
1
+ #: spec1.txt:924 spec2.txt:1188
2
+ msgid "msgid1"
3
+ msgstr "msgstr1"
@@ -0,0 +1,3 @@
1
+ #, c-format
2
+ msgid "msgid1"
3
+ msgstr "%誤"
@@ -0,0 +1,16 @@
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Free Software Foundation, Inc.
3
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
4
+ #
5
+ msgid ""
6
+ msgstr ""
7
+ "Project-Id-Version: Ruby GettextPO\n"
8
+ "PO-Revision-Date: 2026-03-07 13:29+0900\n"
9
+ "Last-Translator: gemmaro <gemmaro.dev@gmail.com>\n"
10
+ "Language-Team: none\n"
11
+ "MIME-Version: 1.0\n"
12
+ "Content-Type: text/plain; charset=UTF-8\n"
13
+ "Content-Transfer-Encoding: 8bit\n"
14
+
15
+ msgid "msgid1"
16
+ msgstr "msgstr1"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # Copyright (C) 2026 gemmaro
2
4
  #
3
5
  # This program is free software: you can redistribute it and/or modify
@@ -13,10 +15,7 @@
13
15
  # You should have received a copy of the GNU General Public License
14
16
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
15
17
 
16
- $LOAD_PATH.unshift File.expand_path("lib", __dir__)
18
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
17
19
  require "gettextpo"
18
20
 
19
- po_path = File.join(__dir__, "test/resources/ok.po")
20
- GettextPO::File.read(po_path).message_iterator.each do |message|
21
- pp({ source: message.msgid, translation: message.msgstr })
22
- end
21
+ require "test-unit"
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gettextpo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - gemmaro
@@ -20,19 +20,33 @@ extra_rdoc_files: []
20
20
  files:
21
21
  - ".clang-format"
22
22
  - ".dir-locals.el"
23
+ - ".env.example"
23
24
  - ".envrc"
24
25
  - ".rdoc_options"
25
26
  - CHANGELOG.md
26
27
  - COPYING
27
28
  - README.md
28
29
  - Rakefile
30
+ - build_config.rb
29
31
  - ext/gettextpo/extconf.rb
30
32
  - ext/gettextpo/gettextpo.c
31
33
  - ext/gettextpo/gettextpo.h
34
+ - include/mrb_gettextpo.h
32
35
  - lib/gettextpo.rb
33
36
  - lib/gettextpo/version.rb
34
- - sample.rb
37
+ - mrbgem.rake
38
+ - mrblib/mrb_gettextpo.rb
39
+ - mrblib/version.rb
35
40
  - sig/gettextpo.rbs
41
+ - src/mrb_gettextpo.c
42
+ - test.cruby/gettextpo_test.rb
43
+ - test.cruby/resources/a.po
44
+ - test.cruby/resources/bad.po
45
+ - test.cruby/resources/filepos.po
46
+ - test.cruby/resources/format.po
47
+ - test.cruby/resources/ok.po
48
+ - test.cruby/test_helper.rb
49
+ - test.cruby/tmp/.keep
36
50
  homepage: https://git.disroot.org/gemmaro/ruby-gettextpo
37
51
  licenses:
38
52
  - GPL-3.0-or-later
@@ -40,6 +54,7 @@ metadata:
40
54
  rubygems_mfa_required: 'true'
41
55
  bug_tracker_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/issues
42
56
  changelog_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/src/branch/main/CHANGELOG.md
57
+ documentation_uri: https://gemmaro.github.io/ruby-gettextpo/
43
58
  homepage_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
44
59
  source_code_uri: https://git.disroot.org/gemmaro/ruby-gettextpo
45
60
  wiki_uri: https://git.disroot.org/gemmaro/ruby-gettextpo/wiki