Permalink
Browse files

Test suite refactoring (spec/S29).

Copied [ul]c[first] test scripts.


git-svn-id: http://svn.pugscode.org/pugs@19446 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
1 parent ff33857 commit 1c32a4ac273c59f3cbee1a764394e13589b04c08 cosimo committed Jan 12, 2008
Showing with 95 additions and 0 deletions.
  1. +27 −0 S29-functions/str/lc.t
  2. +24 −0 S29-functions/str/lcfirst.t
  3. +32 −0 S29-functions/str/uc.t
  4. +12 −0 S29-functions/str/ucfirst.t
@@ -0,0 +1,27 @@
+use v6-alpha;
+
+use Test;
+
+plan 11;
+
+# L<S29/Str/lc>
+
+is(lc("hello world"), "hello world", "lowercasing string which is already lowercase");
+is(lc("Hello World"), "hello world", "simple lc test");
+is(lc(""), "", "empty string");
+is(lc("ÅÄÖ"), "åäö", "some finnish non-ascii chars");
+is(lc("ÄÖÜ"), "äöü", "lc of German Umlauts");
+is(lc("ÓÒÚÙ"), "óòúù", "accented chars");
+is(lc('A'..'C'), "a b c", "lowercasing char-range");
+
+$_ = "Hello World";
+my $x = .lc;
+is($x, "hello world", 'lc uses $_ as default');
+
+{ # test invocant syntax for lc
+ my $x = "Hello World";
+ is($x.lc, "hello world", '$x.lc works');
+ is("Hello World".lc, "hello world", '"Hello World".lc works');
+}
+
+is("ÁÉÍÖÜÓŰŐÚ".lc, "áéíöüóűőú", ".lc on Hungarian vowels");
@@ -0,0 +1,24 @@
+use v6-alpha;
+
+use Test;
+
+plan 8;
+
+# L<S29/Str/lcfirst>
+
+is lcfirst("HELLO WORLD"), "hELLO WORLD", "simple";
+is lcfirst(""), "", "empty string";
+is lcfirst("ÜÜÜÜ"), "üÜÜÜ", "umlaut";
+is lcfirst("ÓÓÓÓŃ"), "óÓÓÓŃ", "accented chars";
+
+is "HELLO WORLD".lcfirst, "hELLO WORLD", "simple.lcfirst";
+
+my $str = "Some String";
+is $str.lcfirst, "some String", "simple.lcfirst on scalar variable";
+is "Other String".lcfirst, "other String", ".lcfirst on literal string";
+
+$_ = "HELLO WORLD";
+my $x = .lcfirst;
+is $x, "hELLO WORLD", 'lcfirst uses $_ as default'
+
+
@@ -0,0 +1,32 @@
+use v6-alpha;
+
+use Test;
+
+plan 11;
+force_todo 10;
+
+# L<S29/"Str"/=item uc>
+
+is(uc("Hello World"), "HELLO WORLD", "simple");
+is(uc(""), "", "empty string");
+is(uc("åäö"), "ÅÄÖ", "some finnish non-ascii chars");
+is(uc("äöü"), "ÄÖÜ", "uc of German Umlauts");
+is(uc("óòúù"), "ÓÒÚÙ", "accented chars");
+is(uc(lc('HELL..')), 'HELL..', "uc/lc test");
+
+# given does not return proper value yet
+$_ = "Hello World";
+my $x = .uc;
+is $x, "HELLO WORLD", 'uc uses the default $_';
+
+{
+ my $x = "Hello World";
+ is $x.uc, "HELLO WORLD", '$x.uc works';
+ is "Hello World".uc, "HELLO WORLD", '"Hello World".uc works';
+}
+
+# Bug: GERMAN SHARP S ("ß") should uc() to "SS", but it doesn't
+# Compare with: perl -we 'use utf8; print uc "ß"'
+is(uc("ß"), "SS", "uc() of non-ascii chars may result in two chars");
+
+is("áéíöüóűőú".uc, "ÁÉÍÖÜÓŰŐÚ", ".uc on Hungarian vowels");
@@ -0,0 +1,12 @@
+use v6-alpha;
+
+use Test;
+
+plan 4;
+
+# L<S29/Str/ucfirst>
+
+is ucfirst("hello world"), "Hello world", "simple";
+is ucfirst(""), "", "empty string";
+is ucfirst("üüüü"), "Üüüü", "umlaut";
+is ucfirst("óóóó"), "Óóóó", "accented chars";

0 comments on commit 1c32a4a

Please sign in to comment.