Fixed logic and tests
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user