From 521a599a60206b61b1ac76dd0f01d20f95d3d588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Kuczborski?= Date: Fri, 9 Apr 2021 23:37:54 +0200 Subject: [PATCH] Fixed logic and tests --- Sources/Variable.swift | 2 -- Tests/StencilTests/VariableSpec.swift | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Sources/Variable.swift b/Sources/Variable.swift index dbb97b3..122fa4a 100644 --- a/Sources/Variable.swift +++ b/Sources/Variable.swift @@ -51,8 +51,6 @@ public struct Variable: Equatable, Resolvable { if variable.count > 1 && ((variable.hasPrefix("'") && variable.hasSuffix("'")) || (variable.hasPrefix("\"") && variable.hasSuffix("\""))) { // String literal return String(variable[variable.index(after: variable.startIndex) ..< variable.index(before: variable.endIndex)]) - } else { - return "" } // Number literal diff --git a/Tests/StencilTests/VariableSpec.swift b/Tests/StencilTests/VariableSpec.swift index da712ce..e25da2e 100644 --- a/Tests/StencilTests/VariableSpec.swift +++ b/Tests/StencilTests/VariableSpec.swift @@ -67,7 +67,7 @@ final class VariableTests: XCTestCase { it("can resolve a string literal with one double quote") { let variable = Variable("\"") let result = try variable.resolve(self.context) as? String - try expect(result) == "" + try expect(result).to.beNil() } it("can resolve a string literal with single quotes") { @@ -79,7 +79,7 @@ final class VariableTests: XCTestCase { it("can resolve a string literal with one single quote") { let variable = Variable("'") let result = try variable.resolve(self.context) as? String - try expect(result) == "" + try expect(result).to.beNil() } it("can resolve an integer literal") {