File: pkgjs-ln

package info (click to toggle)
pkg-js-tools 0.16.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,992 kB
  • sloc: perl: 4,975; sh: 840; makefile: 36; javascript: 22
file content (37 lines) | stat: -rwxr-xr-x 978 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl

use strict;
use Test::More;
use Dpkg::IPC;

my @tests = (

    # Simple package
    'abab'    => 'node_modules/abab',
    '-t abab' => 'node_modules/abab',

    # Module
    'slice-ansi'    => 'node_modules/slice-ansi',
    '-t slice-ansi' => 'node_modules/@types/slice-ansi',
);

plan tests => 3 * scalar(@tests);

foreach ( 0 .. 1 ) {
    diag 'Retry with existing links' if $_;
    for ( my $i = 0 ; $i < @tests ; $i += 2 ) {
        my ( $args, $res ) = ( $tests[$i], $tests[ $i + 1 ] );
        my ( $out,  $err );
        spawn(
            exec            => [ 'pkgjs-ln', split( /\s+/, $args ) ],
            nocheck         => 1,
            wait_child      => 1,
            to_string       => \$out,
            error_to_string => \$err,
        );
        my $status = $?;
        ok( !$status, 'command succeeded' );
        ok( -l $res,  "link to $res exists" );
        ok( $out =~ /(?:linked into node_modules|exists)/, 'Good output' );
    }
}