projects/guix·blob java-team · refs

66 lines · 2.4 KiB

1From 698e39a251d433e2cd2934586a2dfc5e6582c4f9 Mon Sep 17 00:00:00 2001
2From: Philip McGrath <[email protected]>
3Date: Sun, 24 Jul 2022 09:12:55 -0400
4Subject: [PATCH] Improve readability of whitespace tests
5
6This change fixes the test for `~x` in some environments in which it
7was previously failing.
8
9Related to https://github.com/inukshuk/latex-decode/issues/13
10---
11 features/step_definitions/latex.rb | 5 +++++
12 features/symbols.feature | 7 -------
13 features/whitespace.feature | 13 +++++++++++++
14 3 files changed, 18 insertions(+), 7 deletions(-)
15 create mode 100644 features/whitespace.feature
16
17diff --git a/features/step_definitions/latex.rb b/features/step_definitions/latex.rb
18index 4b1b595..fca63c0 100644
19--- a/features/step_definitions/latex.rb
20+++ b/features/step_definitions/latex.rb
21@@ -5,3 +5,8 @@ end
22 Then /^the result should be ('|")(.*)\1$/ do |quote,value|
23 expect(@result).to eq(value)
24 end
25+
26+# For whitespace or other characters that are hard to read in source code:
27+Then /^I should get '([^']*)' \+ U\+(\h{4,}) \+ '([^']*)'$/ do |pre,code,post|
28+ expect(@result).to eq(pre + code.hex.chr(Encoding::UTF_8) + post)
29+end
30diff --git a/features/symbols.feature b/features/symbols.feature
31index 46d9a51..f8a5e84 100644
32--- a/features/symbols.feature
33+++ b/features/symbols.feature
34@@ -12,10 +12,3 @@ Feature: Decode LaTeX symbol directives
35 | \\uparrow | ↑ |
36 | \\downarrow | ↓ |
37 | \\rightarrow | → |
38-
39- Scenarios: Whitespace
40- | latex | unicode | description |
41- | x\\,x | x x | small space |
42- | x~x | x x | non-breaking space |
43- | ~x |  x | non-breaking space |
44-
45diff --git a/features/whitespace.feature b/features/whitespace.feature
46new file mode 100644
47index 0000000..fe5b208
48--- /dev/null
49+++ b/features/whitespace.feature
50@@ -0,0 +1,13 @@
51+Feature: Decode LaTeX whitespace directives
52+ As a hacker who works with LaTeX
53+ I want to be able to decode LaTeX whitespace
54+
55+ Scenario Outline: LaTeX to Unicode transformation
56+ When I decode the string '<latex>'
57+ Then I should get <pre> + U+<code> + <post>
58+
59+ Scenarios: Whitespace
60+ | latex | pre | code | post | description |
61+ | x~x | 'x' | 00A0 | 'x' | non-breaking space |
62+ | ~y | '' | 00A0 | 'y' | leading non-breaking space |
63+ | z\\,z | 'z' | 2009 | 'z' | small space |
64--
652.32.0
66