Bug #63336 for Text-Unidecode: [PATCH] Wide character in print
This queue is for tickets about the Text-Unidecode CPAN distribution.
Report information
The Basics
People
Owner:
Nobody in particular
Requestors:
DOHERTY [...] cpan.org
Cc:
AdminCc:
BugTracker
Severity:
(no value)
Broken in:
0.04
Fixed in:
(no value)
From doherty@cs.dal.ca Thu Nov 25 11: | 31:13 2010 |
MIME-Version: | 1.0 |
X-Spam-Status: | No, score=-6.9 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5] autolearn=ham |
In-Reply-To: | <rt-3.8.HEAD-2363-1290699874-1846.63336-3-0@rt.cpan.org> |
X-Spam-Flag: | NO |
References: | <RT-Ticket-63336@rt.cpan.org> <rt-3.8.HEAD-2363-1290699874-1846.63336-3-0@rt.cpan.org> |
X-Virus-Scanned: | Debian amavisd-new at bestpractical.com |
Message-ID: | <4CEE8F48.9070702@cs.dal.ca> |
Content-Type: | text/plain; charset=UTF-8 |
X-RT-Original-Encoding: | utf-8 |
X-Spam-Score: | -6.9 |
Received: | from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id E5A2C2411DA for <cpan-bug+Text-Unidecode@hipster.bestpractical.com>; Thu, 25 Nov 2010 11:31:12 -0500 (EST) |
Received: | from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c-XQ5d6WuelM for <cpan-bug+Text-Unidecode@hipster.bestpractical.com>; Thu, 25 Nov 2010 11:31:10 -0500 (EST) |
Received: | from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 158C72411B9 for <bug-Text-Unidecode@rt.cpan.org>; Thu, 25 Nov 2010 11:31:09 -0500 (EST) |
Received: | (qmail 29885 invoked by uid 103); 25 Nov 2010 16:31:09 -0000 |
Received: | from x16.dev (10.0.100.26) by x1.dev with QMQP; 25 Nov 2010 16:31:09 -0000 |
Received: | from hammer.CS.Dal.Ca (HELO hammer.cs.dal.ca) (129.173.22.32) by 16.mx.develooper.com (qpsmtpd/0.80) with ESMTP; Thu, 25 Nov 2010 08:31:06 -0800 |
Received: | from [192.168.0.10] (hlfxns0188w-099192050171.pppoe-dynamic.High-Speed.ns.bellaliant.net [99.192.50.171]) by hammer.cs.dal.ca (Postfix) with ESMTP id E1B4A50570 for <bug-Text-Unidecode@rt.cpan.org>; Thu, 25 Nov 2010 12:31:00 -0400 (AST) |
Delivered-To: | cpan-bug+Text-Unidecode@hipster.bestpractical.com |
User-Agent: | Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.23) Gecko/20090817 Thunderbird/2.0.0.23 Mnenhy/0.7.6.0 |
Subject: | Re: [rt.cpan.org #63336] [PATCH] Rewrite test suite using Test::More |
Return-Path: | <doherty@cs.dal.ca> |
X-Spam-Check-BY: | 16.mx.develooper.com |
X-Original-To: | cpan-bug+Text-Unidecode@hipster.bestpractical.com |
X-RT-Mail-Extension: | text-unidecode |
Date: | Thu, 25 Nov 2010 12:31:04 -0400 |
X-Spam-Level: | |
To: | bug-Text-Unidecode@rt.cpan.org |
X-Enigmail-Version: | 1.0.1 |
Content-Transfer-Encoding: | 7bit |
From: | Mike Doherty <doherty@cs.dal.ca> |
RT-Message-ID: | <rt-3.8.HEAD-2360-1290702673-1932.63336-0-0@rt.cpan.org> |
Content-Length: | 5015 |
Rewrite test suite using Test::More
This fixes #63336: Wide character in print at test.pl line xx
---
t/01-basic.t | 22 +++++++++++++
t/02-complex.t | 38 ++++++++++++++++++++++
test.pl | 96
--------------------------------------------------------
3 files changed, 60 insertions(+), 96 deletions(-)
create mode 100644 t/01-basic.t
create mode 100644 t/02-complex.t
delete mode 100644 test.pl
diff --git a/t/01-basic.t b/t/01-basic.t
new file mode 100644
index 0000000..c79fe73
--- /dev/null
+++ b/t/01-basic.t
@@ -0,0 +1,22 @@
+require 5.006;
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Text::Unidecode;
+
+my @tests = (
+ # Basic string tests
+ "",
+ 1/10,
+ "I like pie.",
+ "\n",
+ "\cm\cj",
+ "I like pie.\n",
+);
+plan tests => scalar @tests;
+
+foreach my $line (@tests) {
+ my $is = unidecode($line);
+ is($is, $line, "$line comes through unidecode unscathed");
+}
\ No newline at end of file
diff --git a/t/02-complex.t b/t/02-complex.t
new file mode 100644
index 0000000..e91f35c
--- /dev/null
+++ b/t/02-complex.t
@@ -0,0 +1,38 @@
+require 5.006;
+use strict;
+use warnings;
+use utf8;
+use Test::More;
+use Text::Unidecode;
+
+# Avoid "Wide character in print" warning
+my $builder = Test::More->builder;
+binmode $builder->output, ":utf8";
+binmode $builder->failure_output, ":utf8";
+binmode $builder->todo_output, ":utf8";
+
+my $tests = {
+ # Complex tests
+ "\x{C6}neid" => "AEneid",
+ "\x{E9}tude" => "etude",
+ "\x{5317}\x{4EB0}" => "Bei Jing ", # Chinese
+ "\x{1515}\x{14c7}\x{14c7}" => "shanana", # Canadian syllabics
+ "\x{13d4}\x{13b5}\x{13c6}" => "taliqua", # Cherokee
+ "\x{0726}\x{071b}\x{073d}\x{0710}\x{073a}" => "ptu'i", # Syriac
+ "\x{0905}\x{092d}\x{093f}\x{091c}\x{0940}\x{0924}" => "abhijiit", #
Devanagari
+ "\x{0985}\x{09ad}\x{09bf}\x{099c}\x{09c0}\x{09a4}" => "abhijiit", #
Bangali
+ "\x{0d05}\x{0d2d}\x{0d3f}\x{0d1c}\x{0d40}\x{0d24}" => "abhijiit", #
Malayalaam
+ # The Malayalaam word for "Malayalaam"
+ # If we were doing this right, it should come out as "malayalaam" -
not "mlyaalm"
+ "\x{0d2e}\x{0d32}\x{0d2f}\x{0d3e}\x{0d32}\x{0d2e}\x{0d4d}" =>
"mlyaalm",
+ "\x{3052}\x{3093}\x{307e}\x{3044}\x{8336}" => "genmaiCha ", # Japanese
+};
+plan tests => scalar keys %$tests;
+
+foreach my $line (keys %$tests) {
+ my $was = $line;
+ my $should = $tests->{$line};
+ my $is = unidecode($was);
+
+ is($is, $should, "$was -> $is (should be: $should)");
+}
diff --git a/test.pl b/test.pl
deleted file mode 100644
index 51d5d66..0000000
--- a/test.pl
+++ /dev/null
@@ -1,96 +0,0 @@
-
-# Before `make install' is performed this script should be runnable with
-# `make test'. After `make install' it should work as `perl test.pl'
-
-######################### We start with some black magic to print on
failure.
- # Time-stamp: "2001-07-14 01:48:48 MDT"
-
-require 5.006;
- # This is a Perl program.
-use strict;
-use utf8;
-use Test;
-
-BEGIN { plan tests => 17 }
-
-use Text::Unidecode;
-
-ok 1;
-print "# Text::Unidecode v$Text::Unidecode::VERSION\n",
- "# Perl v$]\n",
- "# Starting tests...\n";
-
-my $in = "\x{0d9c}\x{0d8e}!\n";
-my($was, $should, $is);
-foreach my $line (
-
-#"# 7-bit purity tests: all chars 00 to 7F\n",
-#map(\ord($_), 0x00 .. 0x7f),
-
-"# Basic string tests\n",
-\(
- "",
- 1/10,
- "I like pie.",
- "\n",
- "\cm\cj",
- "I like pie.\n",
-),
-
-"#\n",
-"# COMPLEX TESTS\n",
-
-split(m/\n/, <<"EOTESTS"),
-<\x{C6}neid> <AEneid>
-<\x{E9}tude> <etude>
-<\x{5317}\x{4EB0}> <Bei Jing >
- ; Chinese
-<\x{1515}\x{14c7}\x{14c7}> <shanana>
- ; Canadian syllabics
-<\x{13d4}\x{13b5}\x{13c6}> <taliqua>
- ; Cherokee
-<\x{0726}\x{071b}\x{073d}\x{0710}\x{073a}> <ptu'i>
- ; Syriac
-<\x{0905}\x{092d}\x{093f}\x{091c}\x{0940}\x{0924}> <abhijiit>
- ; Devanagari
-<\x{0985}\x{09ad}\x{09bf}\x{099c}\x{09c0}\x{09a4}> <abhijiit>
- ; Bengali
-<\x{0d05}\x{0d2d}\x{0d3f}\x{0d1c}\x{0d40}\x{0d24}> <abhijiit>
- ; Malayalaam
-<\x{0d2e}\x{0d32}\x{0d2f}\x{0d3e}\x{0d32}\x{0d2e}\x{0d4d}> <mlyaalm>
- ; the Malayaalam word for "Malayaalam"
- ; Yes, if we were doing it right, that'd be "malayaalam", not "mlyaalm"
-
-<\x{3052}\x{3093}\x{307e}\x{3044}\x{8336}> <genmaiCha >
- ; Japanese, astonishingly unmangled.
-
-EOTESTS
-
-# TODO: more tests, I guess.
-
-"# End of test data\n",
-) {
- if(ref $line) { # it should pass thru untouched
- #print ref($line), "\n";
- $was = $should = $$line;
- } else {
- if($line =~ m/<(.*?)>\s*<(.*?)>/ or $line =~
m/\[(.*?)\]\s*\[(.*?)\]/ ){
- ($was, $should) = ($1,$2);
- } else {
- print $line if $line =~ m/^\s*#/s;
- next;
- }
- }
- $is = unidecode($was);
- if($should eq $is) {
- ok 1;
- for($should, $is, $was) { s/\n/\\n/g; s/\cm/\\cm/g; s/\cj/\\cj/g; }
- print " # <$was> -> <$is> (ok)\n";
- } else {
- ok 0;
- for($should, $is, $was) { s/\n/\\n/g }
- print " # <$was> -> <$is>, but should be <$should>\n";
- }
-}
-print "# Byebye\n";
-
This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.
Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.
Time to display: 0.233345 - RT Version 5.0.1
Copyright 1996-2021 »|« Best Practical Solutions, LLC.