You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by di...@apache.org on 2022/10/25 14:43:37 UTC
[sling-org-apache-sling-scripting-sightly-testing] branch master updated: SLING-10654: add test case for icu plural format (#5)
This is an automated email from the ASF dual-hosted git repository.
diru pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing.git
The following commit(s) were added to refs/heads/master by this push:
new b90b087 SLING-10654: add test case for icu plural format (#5)
b90b087 is described below
commit b90b0871b87a76bfb69d788fb48c817b03c52d51
Author: Dirk Rudolph <di...@apache.org>
AuthorDate: Tue Oct 25 16:43:31 2022 +0200
SLING-10654: add test case for icu plural format (#5)
---
.../sightly/it/SlingSpecificsSightlyIT.java | 16 ++++++++++++++-
src/test/provisioning/icu4j.txt | 23 ++++++++++++++++++++++
2 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java b/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
index 80a9e81..db1d633 100644
--- a/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
+++ b/src/test/java/org/apache/sling/scripting/sightly/it/SlingSpecificsSightlyIT.java
@@ -423,7 +423,7 @@ public class SlingSpecificsSightlyIT {
}
@Test
- public void testFormatWithPredefinedStyles() {
+ public void testFormatDateWithPredefinedStyles() {
String url = launchpadURL + SLING_FORMAT;
String pageContent = client.getStringContent(url, 200);
assertEquals("01.12.1918", HTMLExtractor.innerHTML(url, pageContent, "#format-date-1"));
@@ -432,6 +432,20 @@ public class SlingSpecificsSightlyIT {
assertEquals("Sonntag, 1. Dezember 1918", HTMLExtractor.innerHTML(url, pageContent, "#format-date-4"));
}
+ @Test
+ public void testFormatStringWithIcuPlural() {
+ String url = launchpadURL + SLING_FORMAT;
+ String pageContent = client.getStringContent(url, 200);
+ assertEquals("0 results", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-zero"));
+ assertEquals("1 result", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-one"));
+ assertEquals("3 results", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-few"));
+ assertEquals("15 results", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-many"));
+ assertEquals("0 výsledků", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-zero-cs"));
+ assertEquals("1 výsledek", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-one-cs"));
+ assertEquals("3 výsledky", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-few-cs"));
+ assertEquals("15 výsledků", HTMLExtractor.innerHTML(url, pageContent, "#format-icu-plural-many-cs"));
+ }
+
@Test
public void testXSSAttributeEscaping() {
String url = launchpadURL + TCK_XSS;
diff --git a/src/test/provisioning/icu4j.txt b/src/test/provisioning/icu4j.txt
new file mode 100644
index 0000000..a96e038
--- /dev/null
+++ b/src/test/provisioning/icu4j.txt
@@ -0,0 +1,23 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+
+[feature name=icu4j]
+
+[artifacts]
+ com.ibm.icu/icu4j/69.1