Definitions/File/Ru.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 1 SCAR 6.9
CC
1
Cov
0%
import
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Test::BDD::Cucumber::Definitions::File::Ru;
2  
3 use strict;
4 use warnings;
5 use utf8;
6 use DDP;
7 use Test::BDD::Cucumber::Definitions qw(Given When Then);
8 use Test::BDD::Cucumber::Definitions::File qw(File);
9  
10 our $VERSION = '0.41';
11  
12 ## no critic [RegularExpressions::ProhibitCaptureWithoutTest]
13 ## no critic [RegularExpressions::RequireExtendedFormatting]
14 ## no critic [RegularExpressions::ProhibitComplexRegexes]
15  
16 =encoding utf8
17  
18 =head1 NAME
19  
20 Test::BDD::Cucumber::Definitions::File::Ru - Шаги на русском языке
21 для работы с файлами
22  
23 =head1 SYNOPSIS
24  
25 В файле B<features/step_definitions/file_steps.pl>:
26  
27 #!/usr/bin/perl
28  
29 use strict;
30 use warnings;
31 use utf8;
32 use open qw(:std :utf8);
33  
34 use Test::BDD::Cucumber::Definitions::File::Ru;
35  
36 В файле B<features/file.feature>:
37  
38 Feature: File (Ru)
39 Работа с файлами
40  
41 Scenario: File is a directory
42 Given задан путь к файлу "/home/user"
43 Then файл имеет тип "directory"
44  
45 =head1 Типы файлов
46  
47 Файлы могут быть следующих типов (L<согласно документации|https://perldoc.perl.org/functions/-X.html>):
48  
49 =over 4
50  
51 =item * B<regular file>
52  
53 =item * B<directory>
54  
55 =item * B<symbolic link>
56  
57 =item * B<fifo>
58  
59 =item * B<socket>
60  
61 =item * B<block special file>
62  
63 =item * B<character special file>
64  
65 =back
66  
67 Названия типов совпадают с теми, которые показывает команда C<stat>.
68  
69 =head1 ШАГИ
70  
71 =cut
72  
73 sub import {
74  
75 =head2 Условия
76  
77 =pod
78  
79 Задать путь к файлу (или каталогу):
80  
81 Given задан путь к файлу "/var/lib/test.txt"
82  
83 =cut
84  
85 # file path set "(.*)"
86 Given qr/задан путь к файлу "(.*)"/, sub {
87 File->path_set($1);
88 };
89  
90 =head2 Действия
91  
92 =pod
93  
94 Прочитать содержимое текстового файла:
95  
96 When прочитан текстовый файл в кодировке "utf-8"
97  
98 =cut
99  
100 # file read text "(.*)"
101 When qr/прочитан текстовый файл в кодировке "(.*)"/, sub {
102 File->read_text($1);
103 };
104  
105 =pod
106  
107 Прочитать содержимое двоичного файла:
108  
109 When прочитан двоичный файл
110  
111 =cut
112  
113 # file read binary
114 When qr/прочитан двоичный файл/, sub {
115 File->read_binary();
116 };
117  
118 =head2 Проверки
119  
120 =pod
121  
122 Проверить наличие файла:
123  
124 When файл существует
125  
126 =cut
127  
128 # file exists
129 Then qr/файл существует/, sub {
130 File->exists_yes();
131 };
132  
133 =pod
134  
135 Проверить отсутствие файла:
136  
137 When файл не существует
138  
139 =cut
140  
141 # file not exists
142 Then qr/файл не существует/, sub {
143 File->exists_no();
144 };
145  
146 =pod
147  
148 Проверить тип файла:
149  
150 When файл имеет тип "regular file"
151  
152 =cut
153  
154 # file type is "(.*)"
155 Then qr/файл имеет тип "(.*)"/, sub {
156 File->type_is($1);
157 };
158  
159 return;
160 }
161  
162 1;
163  
164 =head1 AUTHOR
165  
166 Mikhail Ivanov C<< <m.ivanych@gmail.com> >>
167  
168 =head1 LICENSE AND COPYRIGHT
169  
170 Copyright 2018 Mikhail Ivanov.
171  
172 This is free software; you can redistribute it and/or modify it
173 under the same terms as the Perl 5 programming language system itself.
174  
175 =pod