Commits

Shlomi Fish committed b79bfb2

Add the format_ref functionality.

Comments (0)

Files changed (2)

Module-Format/Module-Format/lib/Module/Format/Module.pm

         if ($string =~ $regex)
         {
             my $format_id = $format_record->{name};
-            # $out_format_ref = ...
+
+            ${$out_format_ref} = $format_id;
+
             return $class->from({value => $string, format => $format_id,});
         }
     }

Module-Format/Module-Format/t/module.t

 use strict;
 use warnings;
 
-use Test::More tests => 43;
+use Test::More tests => 46;
 
 use Module::Format::Module;
 
     );
 }
 
+{
+    my $chosen_format;
+    my $module = Module::Format::Module->from_guess(
+        {
+            value => 'perl(Acme::Hello::Descriptive)',
+            format_ref => \$chosen_format,
+        }
+    );
+    
+    # TEST
+    ok ($module, "from_guess initialises a module.");
+
+    # TEST
+    is_deeply(
+        $module->get_components_list(),
+        [qw(Acme Hello Descriptive)],
+        "from_guess got good components.",
+    );
+
+    # TEST
+    is ($chosen_format, 'rpm_colon', 'chosen format was initialised');
+}