Permalink
Browse files

Added failing test (wrapped in TODO) from RT #74923

  • Loading branch information...
1 parent 53238d6 commit fc1e4d26a231f13e6a65c082f03351881199d28d @mstratman committed Apr 11, 2012
Showing with 47 additions and 0 deletions.
  1. +23 −0 t/02.array.t
  2. +24 −0 t/nb.pm
View
@@ -0,0 +1,23 @@
+use Test::More;
+use lib 't/lib';
+use DateTime::Format::Human::Duration;
+use DateTime;
+
+
+my $dta = DateTime->now( locale => 'nb' );
+my $dtb = $dta->clone->add( minutes => 1 );
+my $dtc = $dta->clone->subtract( minutes => 1 );
+
+
+my $fmt = DateTime::Format::Human::Duration->new;
+
+TODO: {
+ local $TODO = "See outstanding RT issue #74923: https://rt.cpan.org/Public/Bug/Display.html?id=74923";
+ is($fmt->format_duration_between($dta, $dtb, past => '%s ago', future => 'in %s'),
+ 'in 1mi');
+
+ is($fmt->format_duration_between($dta, $dtc, past => '%s ago', future => 'in %s'),
+ '1mi ago');
+}
+
+done_testing();
View
24 t/nb.pm
@@ -0,0 +1,24 @@
+package DateTime::Format::Human::Duration::Locale::nb;
+# XXX: this isn't really NB locale, I just cheat the system.
+#
+sub get_human_span_from_units_array {
+ my ($years, $months, $weeks, $days, $hours, $minutes, $seconds, $nanoseconds, $args_hr) = @_; # note: has no negative numbers
+ if ($years) {
+ $s = $years . "y";
+ } elsif ($months) {
+ $s = $months . "mo";
+ } elsif ($weeks) {
+ $s = $weeks . "w";
+ } elsif ($days) {
+ $s = $days . "d";
+ } elsif ($hours) {
+ $s = $hours . "h";
+ } elsif ($minutes) {
+ $s = $minutes . "mi";
+ } elsif ($seconds) {
+ $s = "moments";
+ }
+ return $s;
+}
+
+1;

0 comments on commit fc1e4d2

Please sign in to comment.