• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DrHyde / perl-modules-Data-Compare / 8106169812

01 Mar 2024 03:33AM UTC coverage: 90.58%. Remained the same
8106169812

Pull #35

github

web-flow
Bump cross-platform-actions/action from 0.22.0 to 0.23.0

Bumps [cross-platform-actions/action](https://github.com/cross-platform-actions/action) from 0.22.0 to 0.23.0.
- [Release notes](https://github.com/cross-platform-actions/action/releases)
- [Changelog](https://github.com/cross-platform-actions/action/blob/master/changelog.md)
- [Commits](https://github.com/cross-platform-actions/action/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: cross-platform-actions/action
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #35: Bump cross-platform-actions/action from 0.22.0 to 0.23.0

125 of 138 relevant lines covered (90.58%)

424.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

100.0
/lib/Data/Compare/Plugins/Scalar/Properties.pm
1
package Data::Compare::Plugins::Scalar::Properties;
2

3
use warnings;
14✔
4
use strict;
14✔
5
use vars qw($VERSION);
14✔
6
use Data::Compare;
14✔
7

8
$VERSION = 1.25;
9

10
sub register {
11
    return [
12
        ['Scalar::Properties', \&sp_scalar_compare],
14✔
13
        ['', 'Scalar::Properties', \&sp_scalar_compare],
14
    ];
15
}
16

17
# note that when S::Ps are involved we can't use Data::Compare's default
18
# Compare function, so we use eq to check that values are the same.  But
19
# we *do* use D::C::Compare whenever possible.
20

21
# Compare a S::P and a scalar, or if we figure out that we've got two
22
# S::Ps, call sp_sp_compare instead
23

24
sub sp_scalar_compare {
25
    my($scalar, $sp) = @_;
18✔
26

27
    # we don't care what order the two params are, so swap if necessary
28
    ($scalar, $sp) = ($sp, $scalar) if(ref($scalar));
18✔
29

30
    # got two S::Ps?
31
    return sp_sp_compare($scalar, $sp) if(ref($scalar));
18✔
32

33
    # we've really got a scalar and an S::P, so just compare values
34
    return 1 if($scalar eq $sp);
8✔
35
    return 0;
4✔
36
}
37

38
# Compare two S::Ps
39

40
sub sp_sp_compare {
41
    my($sp1, $sp2) = @_;
10✔
42

43
    # first check the values
44
    return 0 unless($sp1 eq $sp2);
10✔
45
    
46
    # now check that we have all the same properties
47
    return 0 unless(Data::Compare::Compare([sort $sp1->get_props()], [sort $sp2->get_props()]));
6✔
48

49
    # and that all properties have the same values
50
    return 0 if(
51
        grep { !Data::Compare::Compare(eval "\$sp1->$_()", eval "\$sp2->$_()") } $sp1->get_props()
4✔
52
    );
53

54
    # if we get here, all is tickety-boo
55
    return 1;
3✔
56
}
57

58
register();
59

60
=head1 NAME
61

62
Data::Compare::Plugin::Scalar::Properties - plugin for Data::Compare to
63
handle Scalar::Properties objects.
64

65
=head1 DESCRIPTION
66

67
Enables Data::Compare to Do The Right Thing for Scalar::Properties
68
objects.
69

70
=over 4
71

72
=item comparing a Scalar::Properties object and an ordinary scalar
73

74
If you compare
75
a scalar and a Scalar::Properties, then they will be considered the same
76
if the two values are the same, regardless of the presence of properties.
77

78
=item comparing two Scalar::Properties objects
79

80
If you compare two Scalar::Properties objects, then they will only be
81
considered the same if the values and the properties match.
82

83
=back
84

85
=head1 AUTHOR
86

87
Copyright (c) 2004 David Cantrell. All rights reserved.
88
This program is free software; you can redistribute it and/or
89
modify it under the same terms as Perl itself.
90

91
=head1 SEE ALSO
92

93
L<Data::Compare>
94

95
=cut
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc