From 3be34d3c201ab9345aab05e8f080cbaf2cfb5d2f Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Sun, 26 Mar 2023 15:35:30 +0100 Subject: [PATCH 1/2] Fix #488 use non-ascii punctuation, not letters The instructions specify that the only input letters will be the 26 english language letters, but we were testing with unlauts. I think it's worth changing the test rather than the instructions because it's ambiguous whether adding diacritics to a letter makes it a new letter or not. I did think about adding a bonus test that makes a decision one way or the other (you could use unicode's NFKD transformation[1] to match letters, ignoring diacritics, or you could maybe use the NFC transformation + maybe splitting to graphemes (depending on if unicode has a codepoint for all "letters" in the alphabet)), but it's a bit complicated. [1]: https://unicode.org/reports/tr15/ --- exercises/practice/pangram/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/pangram/runtests.jl b/exercises/practice/pangram/runtests.jl index cd437cab9..05ee2c4cb 100644 --- a/exercises/practice/pangram/runtests.jl +++ b/exercises/practice/pangram/runtests.jl @@ -54,6 +54,6 @@ end @test ispangram("the 1 quick brown fox jumps Over the 2 lazy dogs") end -@testset "letters that aren't part of ASCII" begin - @test !ispangram("the 1 qüick bröwn föx jümps över the 2 läzy dögs") +@testset "punctuation that isn't part of ASCII" begin + @test ispangram("Wow—the quick brown fox jumps over the lazy dog‽") end From e0f7db9c473f2f60746be44a1ebd98228a12f615 Mon Sep 17 00:00:00 2001 From: Colin Caine Date: Tue, 28 Mar 2023 17:32:21 +0100 Subject: [PATCH 2/2] Avoid diacritics ambiguities in unicode testcase Pangram found here: https://clagnut.com/blog/2380#Arabic --- exercises/practice/pangram/runtests.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/practice/pangram/runtests.jl b/exercises/practice/pangram/runtests.jl index 05ee2c4cb..cf516587d 100644 --- a/exercises/practice/pangram/runtests.jl +++ b/exercises/practice/pangram/runtests.jl @@ -54,6 +54,6 @@ end @test ispangram("the 1 quick brown fox jumps Over the 2 lazy dogs") end -@testset "punctuation that isn't part of ASCII" begin - @test ispangram("Wow—the quick brown fox jumps over the lazy dog‽") +@testset "An Arabic pangram is not an English pangram" begin + @test !ispangram("The scholar and poet Al Farāhīdi wrote this Arabic pangram: صِف خَلقَ خَودِ كَمِثلِ الشَمسِ إِذ بَزَغَت — يَحظى الضَجيعُ بِها نَجلاءَ مِعطارِ") end