From d769b7a9167a2e2cb5d40bdcf0bd16ac000789a3 Mon Sep 17 00:00:00 2001 From: Richard Clamp Date: Fri, 2 Sep 2022 13:40:54 +0100 Subject: [PATCH] Add failing test to demonstrate unicode mishandling As mentioned in https://github.com/richardc/perl-pod-coverage/issues/2 Pod::Parser doesn't handle encodings, which may cause some form of failure. Here in order to understand this, and in the attempt to add a failing test that can be fixed with the correct behaviour, we add a simple test fixture UnicodeHeading that refers to U+1F3A9, the Top Hat in a pod heading. At present it doesn't fail, so more work needed. --- t/lib/UnicodeHeading.pm | 15 +++++++++++++++ t/unicode_heading.t | 12 ++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 t/lib/UnicodeHeading.pm create mode 100644 t/unicode_heading.t diff --git a/t/lib/UnicodeHeading.pm b/t/lib/UnicodeHeading.pm new file mode 100644 index 0000000..ddaf2c6 --- /dev/null +++ b/t/lib/UnicodeHeading.pm @@ -0,0 +1,15 @@ +package UnicodeHeading; +# Unicode subroutine names and pod + +=head2 $self->get_hat 🎩 + +something somthing + +=cut + +sub get_hat {} + + + +1; + diff --git a/t/unicode_heading.t b/t/unicode_heading.t new file mode 100644 index 0000000..d0025e3 --- /dev/null +++ b/t/unicode_heading.t @@ -0,0 +1,12 @@ +#!/usr/bin/perl -w +use strict; +use Test::More tests => 3; +use lib 't/lib'; + +BEGIN { + use_ok( 'Pod::Coverage' ); +} + +my $obj = new Pod::Coverage package => 'UnicodeHeading'; +isa_ok( $obj, 'Pod::Coverage' ); +is($obj->coverage, 1, "Wasn't confused by Unicode in the header");