use v6;
use Test;
plan 4;
use CSS::Properties;
my $css = CSS::Properties.new( :style("color:red !important; background-repeat: repeat-x; background-position: center; border-left-style: inherit") );
is $css.ast(:!optimize), (:declaration-list[
{:expr[:keyw
], :ident},
{:expr[:keyw], :ident},
{:expr[:keyw], :ident},
{:expr[:rgb[:num(255), :num(0), :num(0)]], :ident, :prio }
]), 'ast';
is $css.write(:!optimize), 'background-position:center; background-repeat:repeat-x; border-left-style:inherit; color:red!important;', 'style unoptimized';
my $ast = $css.ast;
is $ast, (:declaration-list[
{:expr["expr:background-repeat" => [:keyw], "expr:background-position" => [:keyw]], :ident("background")},
{:expr[:keyw], :ident},
{:expr[:rgb[:num(255), :num(0), :num(0)]], :ident, :prio }
]), 'ast';
is $css.write , 'background:repeat-x center; border-left-style:inherit; color:red!important;', 'style optimized';
done-testing;