Просмотр исходного кода

test: Add labels to Test::More tests

Fixes TestingAndDebugging::RequireTestLabels.

Warned-by: perlcritic
Guillem Jover лет назад: 13
Родитель
Сommit
0e5d6ee28b
6 измененных файлов с 21 добавлено и 18 удалено
  1. 2 2
      scripts/t/Dpkg_Changelog.t
  2. 3 3
      scripts/t/Dpkg_IPC.t
  3. 5 5
      scripts/t/Dpkg_Package.t
  4. 6 4
      scripts/t/Dpkg_Shlibs.t
  5. 4 4
      src/t/dpkg_divert.t
  6. 1 0
      test/critic.t

+ 2 - 2
scripts/t/Dpkg_Changelog.t

@@ -301,11 +301,11 @@ Xb-Userfield2: foobar
 
 	$str = $changes->rfc822();
 
-	ok( 1 );
+	ok(1, 'TODO check rfc822 output');
 
 	$str = $changes->rfc822({ since => $oldest_version });
 
-	ok( 1 );
+	ok(1, 'TODO check rfc822 output with ranges');
     }
 }
 

+ 3 - 3
scripts/t/Dpkg_IPC.t

@@ -39,7 +39,7 @@ my $pid = spawn(exec => 'cat',
 		from_string => \$string1,
 		to_string => \$string2);
 
-ok($pid);
+ok($pid, 'execute cat program, I/O to variables');
 
 is($string2, $string1, '{from,to}_string');
 
@@ -47,7 +47,7 @@ $pid = spawn(exec => 'cat',
 	     from_handle => $tmp1_fh,
 	     to_handle => $tmp2_fh);
 
-ok($pid);
+ok($pid, 'execute cat program, I/O to filehandles');
 
 wait_child($pid);
 
@@ -64,7 +64,7 @@ $pid = spawn(exec => 'cat',
 	     wait_child => 1,
 	     timeout => 5);
 
-ok($pid);
+ok($pid, 'execute cat program, I/O to filenames, wait and timeout');
 
 open $tmp_fh, '<', $tmp2_name
     or die "cannot open $tmp2_name: $!";

+ 5 - 5
scripts/t/Dpkg_Package.t

@@ -20,10 +20,10 @@ use Test::More tests => 6;
 
 use_ok('Dpkg::Package');
 
-ok(pkg_name_is_illegal(undef));
-ok(pkg_name_is_illegal(''));
-ok(pkg_name_is_illegal('%_&'));
-ok(pkg_name_is_illegal('ABC'));
-ok(pkg_name_is_illegal('-abc'));
+ok(pkg_name_is_illegal(undef), 'package name is undef');
+ok(pkg_name_is_illegal(''), 'package name is empty');
+ok(pkg_name_is_illegal('%_&'), 'package name has invalid chars');
+ok(pkg_name_is_illegal('ABC'), 'package name has uppercase chars');
+ok(pkg_name_is_illegal('-abc'), 'package name has a dash');
 
 1;

+ 6 - 4
scripts/t/Dpkg_Shlibs.t

@@ -535,11 +535,13 @@ is($sym->{minver}, '1.method1', 'specific symbol preferred over pattern');
 
 $sym = $sym_file->lookup_symbol('_ZN3NSB6Symver14symver_method2Ev@SYMVER_1', 'libpatterns.so.1');
 is($sym->{minver}, '1.method2', 'c++ alias pattern preferred over generic pattern');
-is ( $sym->get_pattern()->get_symbolname(), 'NSB::Symver::symver_method2()@SYMVER_1' );
+is($sym->get_pattern()->get_symbolname(), 'NSB::Symver::symver_method2()@SYMVER_1',
+   'c++ alias pattern preferred over generic pattern, on demangled name');
 
 $sym = $sym_file->lookup_symbol('_ZN3NSB6SymverD1Ev@SYMVER_1', 'libpatterns.so.1');
 is ( $sym->{minver}, '1.generic', 'generic (c++ & symver) pattern covers the rest (destructor)' );
-ok ( $sym->get_pattern()->equals($sym_file->create_symbol('(c++|symver)SYMVER_1 1.generic')) );
+ok($sym->get_pattern()->equals($sym_file->create_symbol('(c++|symver)SYMVER_1 1.generic')),
+   'generic (c++ & symver) pattern covers the rest (destructor), compared');
 
 # Test old style wildcard support
 load_patterns_symbols();
@@ -570,7 +572,7 @@ $sym = $sym_file->create_symbol('(regex|c++)^_Z(T[ISV])?N3NSA6ClassA8Internal.*@
 $pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
 is_deeply ([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
     'Pattern covers all internal symbols');
-is ( $tmp[0]->{minver}, '1.internal' );
+is($tmp[0]->{minver}, '1.internal', 'internal pattern covers first symbol');
 
 # Lookup private pattern
 my @private_symnames = sort qw(
@@ -625,7 +627,7 @@ $sym = $sym_file->create_symbol('(regex|c++)^_Z(T[ISV])?N3NSA6ClassA8Internal.*@
 $pat = $sym_file->lookup_pattern($sym, 'libpatterns.so.1');
 is_deeply ([ sort $pat->get_pattern_matches() ], [ sort @tmp ],
     'Pattern covers all internal symbols');
-is ( $tmp[0]->{minver}, '1.internal' );
+is($tmp[0]->{minver}, '1.internal', 'internal pattern covers first symbol');
 
 # Delete matches of the non-optional pattern
 $sym = $sym_file->create_symbol('(c++)"non-virtual thunk to NSB::ClassD::generate_vt(char const*) const@Base" 1');

+ 4 - 4
src/t/dpkg_divert.t

@@ -531,14 +531,14 @@ call_divert(['--rename', "$testdir/foo"]);
 
 call_divert(['--test', '--rename', '--remove', "$testdir/foo"],
             expect_stdout_like => qr{Removing.*\Q$testdir\E/foo}, expect_stderr => '');
-ok(-e "$testdir/foo.distrib");
-ok(!-e "$testdir/foo");
+ok(-e "$testdir/foo.distrib", 'foo diversion not removed');
+ok(!-e "$testdir/foo", 'foo diversion not removed');
 diversions_eq($diversions_added_foo_local);
 
 call_divert(['--quiet', '--rename', '--remove', "$testdir/foo"],
             expect_stdout => '', expect_stderr => '');
-ok(-e "$testdir/foo");
-ok(!-e "$testdir/foo.distrib");
+ok(-e "$testdir/foo", 'foo diversion removed');
+ok(!-e "$testdir/foo.distrib", 'foo diversion removed');
 diversions_eq('');
 
 cleanup();

+ 1 - 0
test/critic.t

@@ -88,6 +88,7 @@ my @policies = qw(
     Subroutines::ProtectPrivateSubs
     TestingAndDebugging::ProhibitNoStrict
     TestingAndDebugging::ProhibitNoWarnings
+    TestingAndDebugging::RequireTestLabels
     TestingAndDebugging::RequireUseStrict
     TestingAndDebugging::RequireUseWarnings
     ValuesAndExpressions::ProhibitCommaSeparatedStatements