-for my $color (@colors) {
- my %color = %{$tests{$color}};
- my $col = Convert::Color::RGB8->new(substr $color, 1);
- isf $col->convert_to('xyz'), $color{xyz}, "convert $color to XYZ";
- isf $col->convert_to('luv'), $color{luv}, "convert $color to LUV";
- isf $col->convert_to('lch'), $color{lch}, "convert $color to LCh";
- isf $col->convert_to('husl'), $color{husl}, "convert $color to HUSL";
- isf $col->convert_to('huslp'), $color{huslp}, "convert $color to HUSLp";
+if ($ENV{RELEASE_TESTING}) {
+ require JSON::MaybeXS;
+ open my $fh, '<', 't/snapshot-rev4.json';
+ my $snapshot = join '', <$fh>;
+
+ my %tests = %{JSON::MaybeXS::decode_json $snapshot};
+
+ for my $color (sort keys %tests) {
+ my $col = Convert::Color::RGB8->new(substr $color, 1);
+ isf $col->convert_to(lc), $tests{$color}{lc()}, "convert $color to $_" for @spaces;
+ }
+} else {
+ open my $fh, '<', 't/snapshot-rev4.csv';
+ <$fh>;
+
+ while (<$fh>) {
+ my ($color, @good) = split ',';
+ my $col = Convert::Color::RGB8->new($color);
+ isf $col->convert_to(lc), \@good, "convert $color to $_" for @spaces
+ }