From 7dce48174e972425e6300eca3cecc02be15d3fcb Mon Sep 17 00:00:00 2001 From: Huy Nguyen Date: Fri, 23 Jun 2017 15:14:39 +0100 Subject: [PATCH] ASDimensionMake to be more lenient #trivial (#382) * ASDimensionMake to be more lenient Don't throw assertion when the string is invalid * Fix unit test --- Source/Layout/ASDimension.mm | 1 - Tests/ASDimensionTests.mm | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/Layout/ASDimension.mm b/Source/Layout/ASDimension.mm index 603885e44..5e42255ab 100644 --- a/Source/Layout/ASDimension.mm +++ b/Source/Layout/ASDimension.mm @@ -47,7 +47,6 @@ ASOVERLOADABLE ASDimension ASDimensionMake(NSString *dimension) } } - ASDisplayNodeCAssert(NO, @"Parsing dimension failed for: %@", dimension); return ASDimensionAuto; } diff --git a/Tests/ASDimensionTests.mm b/Tests/ASDimensionTests.mm index fab3aaf97..6832dc5e8 100644 --- a/Tests/ASDimensionTests.mm +++ b/Tests/ASDimensionTests.mm @@ -29,7 +29,7 @@ - (void)testCreatingDimensionUnitAutos { XCTAssertNoThrow(ASDimensionMake(ASDimensionUnitAuto, 0)); XCTAssertThrows(ASDimensionMake(ASDimensionUnitAuto, 100)); - XCTAssertThrows(ASDimensionMake(@"")); + ASXCTAssertEqualDimensions(ASDimensionAuto, ASDimensionMake(@"")); ASXCTAssertEqualDimensions(ASDimensionAuto, ASDimensionMake(@"auto")); }