curses_menu 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/examples/utf_8.rb +8 -0
- data/lib/curses_menu/version.rb +1 -1
- data/spec/curses_menu_test.rb +9 -5
- data/spec/curses_menu_test/formatting_spec.rb +14 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f2157a04e11d3d2d1e5dbb21cf04a10c7cb4a74bb20594b7132ddb173affaa3
|
4
|
+
data.tar.gz: 65030812b200046ce239732987118775b3e4d8f334368d54d96a03f54d83b481
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 296ff3a85e3a7697a2122bdc0765b943b6c60c422391b7e2b5423e87036088a85248c79ca11cdee209f3d25cd2e0b2f558a4744ad74d0c5307ddbe50890eed2b
|
7
|
+
data.tar.gz: 3b5c8fcb76fac30961b8c636ab1411b77cc0e108f9762c70294da23d18b025589493becc649aec2ed6caae467ba79373e1b34178aca9fca81e90d2a19ca16784
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
# [v0.0.4](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.3...v0.0.4) (2021-08-18 10:25:59)
|
2
|
+
|
3
|
+
### Patches
|
4
|
+
|
5
|
+
* [Test UTF-8 support](https://github.com/Muriel-Salvan/curses_menu/commit/f94129db540d41f17f0ed46563461601f140029f)
|
6
|
+
|
1
7
|
# [v0.0.3](https://github.com/Muriel-Salvan/curses_menu/compare/v0.0.2...v0.0.3) (2021-08-15 16:16:16)
|
2
8
|
|
3
9
|
### Patches
|
data/examples/utf_8.rb
ADDED
data/lib/curses_menu/version.rb
CHANGED
data/spec/curses_menu_test.rb
CHANGED
@@ -50,7 +50,7 @@ module CursesMenuTest
|
|
50
50
|
chars.
|
51
51
|
map do |chr|
|
52
52
|
{
|
53
|
-
char: (chr & Curses::A_CHARTEXT).chr,
|
53
|
+
char: (chr & Curses::A_CHARTEXT).chr(Encoding::UTF_8),
|
54
54
|
color: color_pairs[chr & Curses::A_COLOR] || chr & Curses::A_COLOR,
|
55
55
|
attributes: chr & Curses::A_ATTRIBUTES
|
56
56
|
}
|
@@ -87,11 +87,15 @@ module CursesMenuTest
|
|
87
87
|
#
|
88
88
|
# Parameters::
|
89
89
|
# * *line_idx* (Integer): The line index of the screenshot
|
90
|
-
# * *expectation* (String): The expected line
|
90
|
+
# * *expectation* (String or Regexp): The expected line
|
91
91
|
def assert_line(line_idx, expectation)
|
92
|
-
line = @screenshot[line_idx][0..expectation.size].map { |char_info| char_info[:char] }.join
|
93
|
-
|
94
|
-
|
92
|
+
line = @screenshot[line_idx][0..(expectation.is_a?(Regexp) ? -1 : expectation.size)].map { |char_info| char_info[:char] }.join
|
93
|
+
if expectation.is_a?(Regexp)
|
94
|
+
expect(line).to match(expectation), "Screenshot line #{line_idx} differs:\n \"#{line}\" should be\n \"#{expectation} \""
|
95
|
+
else
|
96
|
+
# Add an ending space to make sure the line does not continue after what we test
|
97
|
+
expect(line).to eq("#{expectation} "), "Screenshot line #{line_idx} differs:\n \"#{line}\" should be\n \"#{expectation} \""
|
98
|
+
end
|
95
99
|
end
|
96
100
|
|
97
101
|
# Assert that a line of the screenshot starts with a given content, using colors information
|
@@ -7,6 +7,20 @@ describe CursesMenu do
|
|
7
7
|
assert_line 3, 'Simple string'
|
8
8
|
end
|
9
9
|
|
10
|
+
it 'displays a single string in UTF-8' do
|
11
|
+
test_menu do |menu|
|
12
|
+
menu.item 'Simple string - 単純な文字列'
|
13
|
+
end
|
14
|
+
# Ruby curses does not handle wide characters correctly in the inch method.
|
15
|
+
# This test is pending a better support for UTF-8.
|
16
|
+
# cf https://github.com/ruby/curses/issues/65
|
17
|
+
# TODO: Uncomment when Ruby curses will be fixed.
|
18
|
+
# rubocop:disable Style/AsciiComments
|
19
|
+
# assert_line 3, 'Simple string - 単純な文字列'
|
20
|
+
# rubocop:enable Style/AsciiComments
|
21
|
+
assert_line 3, /^Simple string - .+$/
|
22
|
+
end
|
23
|
+
|
10
24
|
it 'displays a single string in a CursesRow' do
|
11
25
|
test_menu do |menu|
|
12
26
|
menu.item CursesMenu::CursesRow.new({ cell: { text: 'Simple string' } })
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: curses_menu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Muriel Salvan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curses
|
@@ -89,6 +89,7 @@ extra_rdoc_files:
|
|
89
89
|
- CHANGELOG.md
|
90
90
|
- README.md
|
91
91
|
- LICENSE.md
|
92
|
+
- examples/utf_8.rb
|
92
93
|
- examples/hello.rb
|
93
94
|
- examples/sub_menus.rb
|
94
95
|
- examples/automatic_key_presses.rb
|
@@ -109,6 +110,7 @@ files:
|
|
109
110
|
- examples/scrolling.rb
|
110
111
|
- examples/several_items.rb
|
111
112
|
- examples/sub_menus.rb
|
113
|
+
- examples/utf_8.rb
|
112
114
|
- lib/curses_menu.rb
|
113
115
|
- lib/curses_menu/curses_row.rb
|
114
116
|
- lib/curses_menu/version.rb
|