diff --git a/src/parse/value/eval.rs b/src/parse/value/eval.rs index aa46722..02c3f19 100644 --- a/src/parse/value/eval.rs +++ b/src/parse/value/eval.rs @@ -317,9 +317,9 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> { format!("-{}", right.to_css_string(self.span)?), QuoteKind::None, ), - Value::Dimension(None, ..) => todo!(), + v @ Value::Dimension(None, ..) => v, Value::Dimension(Some(num), unit, _) => match right { - Value::Dimension(None, ..) => todo!(), + v @ Value::Dimension(None, ..) => v, Value::Dimension(Some(num2), unit2, _) => { if !unit.comparable(&unit2) { return Err(( @@ -643,9 +643,9 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> { v => panic!("{:?}", v), }; Ok(match left { - Value::Dimension(None, ..) => todo!(), + v @ Value::Dimension(None, ..) => v, Value::Dimension(Some(n), u, _) => match right { - Value::Dimension(None, ..) => todo!(), + v @ Value::Dimension(None, ..) => v, Value::Dimension(Some(n2), u2, _) => { if !u.comparable(&u2) { return Err( diff --git a/tests/subtraction.rs b/tests/subtraction.rs index f883fe8..ea507fd 100644 --- a/tests/subtraction.rs +++ b/tests/subtraction.rs @@ -282,6 +282,16 @@ test!( "a {\n color: foo - red;\n}\n", "a {\n color: foo-red;\n}\n" ); +test!( + sub_nan_left, + "a {\n left:0/0-0;\n}\n", + "a {\n left: NaN;\n}\n" +); +test!( + sub_nan_right, + "a {\n left:0-0/0;\n}\n", + "a {\n left: NaN;\n}\n" +); error!( number_minus_color, "a {\n color: 1 - #abc;\n}\n", "Error: Undefined operation \"1 - #abc\"."