This repository was archived by the owner on Mar 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgverifyshelf.t
executable file
·64 lines (41 loc) · 2.27 KB
/
gverifyshelf.t
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/perl -w
# Test cases realized:
# [x] shelf name corrections (displayed name vs real ids)
# [ ] invalid shelves
# [ ]
# [ ]
use diagnostics; # More debugging info
use warnings;
use strict;
use FindBin;
use local::lib "$FindBin::Bin/../lib/local/";
use lib "$FindBin::Bin/../lib/";
use Test::More qw( no_plan );
use_ok( 'Goodscrapes' );
# Internal vs displayed shelf names for default GR shelves:
is ( gverifyshelf( '#ALL#' ), '#ALL#', 'Shelf valid' );
is ( gverifyshelf( 'AlL' ), '#ALL#', 'Shelf corrected' );
is ( gverifyshelf( '#AlL' ), '#ALL#', 'Shelf corrected' );
isnt( gverifyshelf( 'all-x' ), '#ALL#', 'Shelf not corrected' );
isnt( gverifyshelf( 'x-all' ), '#ALL#', 'Shelf not corrected' );
isnt( gverifyshelf( 'x-all-x' ), '#ALL#', 'Shelf not corrected' );
is ( gverifyshelf( 'read' ), 'read', 'Shelf valid' );
is ( gverifyshelf( 'ReAd' ), 'read', 'Shelf corrected' );
isnt( gverifyshelf( 'x-read' ), 'read', 'Shelf not corrected' );
isnt( gverifyshelf( 'read-x' ), 'read', 'Shelf not corrected' );
isnt( gverifyshelf( 'x-read-x' ), 'read', 'Shelf not corrected' );
is ( gverifyshelf( 'currently-reading' ), 'currently-reading', 'Shelf valid' );
is ( gverifyshelf( 'CurrEntly_ReAding' ), 'currently-reading', 'Shelf corrected' );
isnt( gverifyshelf( 'x-currently-reading' ), 'currently-reading', 'Shelf not corrected' );
isnt( gverifyshelf( 'currently-reading-x' ), 'currently-reading', 'Shelf not corrected' );
isnt( gverifyshelf( 'x-currently-reading-x' ), 'currently-reading', 'Shelf not corrected' );
is ( gverifyshelf( 'to-read' ), 'to-read', 'Shelf valid' );
is ( gverifyshelf( 'tO_ReaD' ), 'to-read', 'Shelf corrected' );
is ( gverifyshelf( 'Want-To_ReAd' ), 'to-read', 'Shelf corrected' ); # You could have such a shelf but misspelling more likely
isnt( gverifyshelf( 'x-to-read' ), 'to-read', 'Shelf not corrected' );
isnt( gverifyshelf( 'to-read-x' ), 'to-read', 'Shelf not corrected' );
isnt( gverifyshelf( 'x-to-read-x' ), 'to-read', 'Shelf not corrected' );
# User created shelves:
is( gverifyshelf( 'UsEr_CreaTed-shElf' ), 'user_created-shelf', 'Shelf "UsEr_CreaTed-shElf" corrected to lowercase' );
# Invalid shelves:
# @TODO