Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • 07678fe
  • /
  • recipes
  • /
  • 20-test_provider.t
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:6713653214703d8ddc2e4939c08312f3d35a190f
directory badge Iframe embedding
swh:1:dir:05702664796a270a34e20bb4c88dc24c8061164f
20-test_provider.t
#! /usr/bin/env perl
# Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the Apache License 2.0 (the "License").  You may not use
# this file except in compliance with the License.  You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html


use strict;
use warnings;

use OpenSSL::Test;

setup("test_provider");

plan tests => 9;

 SKIP: {
     skip "No default provider?", 6
         unless ok(run(app([qw(openssl provider default)])),
                   "try running 'openssl provider default'");

     my $prev = 2;              # The amount of lines from -v
     my @checks = qw( -v -vv -vvv );
     my %op = ( -v => '==',
                -vv => '>',
                -vvv => '>' );
     my $i = 0;

     foreach (@checks) {
         my @cmd = ('openssl', 'provider', $_, 'default');
         my @lines = ( map { (my $x = $_) =~ s|\R$||; $x }
                       run(app([@cmd]), capture => 1) );

         my $curr = scalar @lines;
         my $cmp = "$curr $op{$_} $prev";

         ok(eval $cmp,
            "'openssl provider $_ default' line count $op{$_} $prev");
         ok($lines[0] eq '[ default ]',
            "'openssl provider -v default' first line is '[ default ]'");

         $prev = $curr;
     }
}

 SKIP: {
     skip "No null provider?", 1
         unless ok(run(app([qw(openssl provider null)])),
                   "try running 'openssl provider null'");

     my @cmd = ('openssl', 'provider', '-vvv', 'null');
     my @lines = ( map { (my $x = $_) =~ s|\R$||; $x }
                   run(app([@cmd]), capture => 1) );

     my $curr = scalar @lines;
     my $cmp = "$curr == 1";
     ok(eval $cmp,
        "'openssl provider $_ default' line count == 1");
}

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top