Commit 43a3f5c2 authored by David Owens II's avatar David Owens II

Added the ability to escape the values.

parent 4844cc4d
Pipeline #1815 passed with stage
...@@ -162,6 +162,7 @@ final public class Lexer { ...@@ -162,6 +162,7 @@ final public class Lexer {
case _ where char == "'": content.append("'"); break case _ where char == "'": content.append("'"); break
case _ where char == "\"": content.append("\""); break case _ where char == "\"": content.append("\""); break
case _ where char == "\\": content.append("\\"); break case _ where char == "\\": content.append("\\"); break
case _ where char == "$": content.append("\\$"); break
default: default:
fatalError("Unsupposed escape sequence: \\\(escaped?.character)") fatalError("Unsupposed escape sequence: \\\(escaped?.character)")
} }
......
...@@ -12,6 +12,12 @@ ...@@ -12,6 +12,12 @@
:output-type "lib" :output-type "lib"
:sources ["src/**.swift" "lib/**.swift"] :sources ["src/**.swift" "lib/**.swift"]
} }
:check {
:tool "shell"
:name "shell-escape"
:script "echo path:\${ATBUILD_USER_PATH}xx"
}
} }
) )
......
...@@ -19,7 +19,8 @@ class SubstitutionTests: Test { ...@@ -19,7 +19,8 @@ class SubstitutionTests: Test {
required init() {} required init() {}
let tests = [ let tests = [
SubstitutionTests.testBasic, SubstitutionTests.testBasic,
SubstitutionTests.testCollectSources SubstitutionTests.testCollectSources,
SubstitutionTests.testEscapedValue
] ]
let filename = #file let filename = #file
...@@ -37,4 +38,10 @@ class SubstitutionTests: Test { ...@@ -37,4 +38,10 @@ class SubstitutionTests: Test {
let package = try Package(filepath: filepath, overlay: [], focusOnTask: nil) let package = try Package(filepath: filepath, overlay: [], focusOnTask: nil)
try test.assert(evaluateSubstitutions(input: "${collect_sources:default}", package: package) == "tests/collateral/collect_sources/src/a.swift tests/collateral/collect_sources/src/b.swift") try test.assert(evaluateSubstitutions(input: "${collect_sources:default}", package: package) == "tests/collateral/collect_sources/src/a.swift tests/collateral/collect_sources/src/b.swift")
} }
static func testEscapedValue() throws {
let filepath = Path("tests/collateral/escape.atpkg")
let package = try Package(filepath: filepath, overlay: [], focusOnTask: nil)
try test.assert(evaluateSubstitutions(input: "\\${ATBUILD_USER_PATH}", package: package) == "${ATBUILD_USER_PATH}")
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment