Perl-module which allows to use Droid/PRONOM signatures and to convert it to Perl regular expressions, analyze files using wxHexEditor tags to display matches and calc statistics. For PRONOM see https://www.nationalarchives.gov.uk/PRONOM/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.3 KiB

  1. #!/usr/bin/perl -w
  2. use strict;
  3. use warnings;
  4. use diagnostics;
  5. use Test::More tests => 9;
  6. use Test::Exception;
  7. use Test::File;
  8. use Path::Tiny;
  9. my $sigfile = path("t/DROID_SignatureFile_V93.xml");
  10. my $ymlfile = path("t/DROID_SignatureFile_V93.xml.yaml");
  11. ### tests
  12. BEGIN { use_ok("File::FormatIdentification::Pronom"); }
  13. new_ok(
  14. "File::FormatIdentification::Pronom" =>
  15. [ { "droid_signature_filename" => $sigfile->absolute } ],
  16. "object 1"
  17. );
  18. file_exists_ok( $ymlfile->absolute, "'object 1' has auto stored file" );
  19. $ymlfile->remove;
  20. new_ok(
  21. "File::FormatIdentification::Pronom" => [
  22. {
  23. "droid_signature_filename" => $sigfile->absolute,
  24. "auto_store" => 0
  25. }
  26. ],
  27. "object 2"
  28. );
  29. file_not_exists_ok( $ymlfile->absolute, "'object 2' has no auto stored file" );
  30. my $obj3a = new_ok(
  31. "File::FormatIdentification::Pronom" => [
  32. {
  33. "droid_signature_filename" => $sigfile->absolute,
  34. "auto_store" => 1
  35. }
  36. ],
  37. "object 3a"
  38. );
  39. file_exists_ok( $ymlfile->absolute, "'object 3a' has auto stored file" );
  40. my $obj3b = new_ok(
  41. "File::FormatIdentification::Pronom" =>
  42. [ { "droid_signature_filename" => $sigfile->absolute } ],
  43. "object 3b'"
  44. );
  45. $ymlfile->remove;
  46. is_deeply( $obj3b, $obj3a, "ensure 'obj3a' equals 'obj3b'" );
  47. 1;