Skip to content

Commit f9dcfe1

Browse files
authored
fix scripting mode: can now use operators (#5591)
* fix scripting mode: can now use operators fixes #5558 * 0.6.1
1 parent 27c1476 commit f9dcfe1

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

joern-cli/src/test/scala/io/joern/joerncli/RunScriptTests.scala

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,7 @@ class RunScriptTests extends AnyWordSpec with Matchers {
3434
"execute a simple script" in new Fixture {
3535
def test(scriptFile: Path, outputFile: Path) = {
3636
val escScriptPath = outputFile.toString.replace("\\", "\\\\")
37-
Files.writeString(
38-
scriptFile,
39-
s"""
40-
|val fw = new java.io.FileWriter("$escScriptPath", true)
41-
|fw.write("michael was here")
42-
|fw.close()
43-
""".stripMargin
44-
)
37+
Files.writeString(scriptFile, s""""michael was here" #> "$escScriptPath"""".stripMargin)
4538

4639
ReplBridge.main(Array("--script", scriptFile.toString))
4740

@@ -57,9 +50,7 @@ class RunScriptTests extends AnyWordSpec with Matchers {
5750
scriptFile,
5851
s"""
5952
|@main def foo(outFile: String, magicNumber: Int) = {
60-
| val fw = new java.io.FileWriter(outFile, true)
61-
| fw.write(magicNumber.toString)
62-
| fw.close()
53+
| magicNumber #> outFile
6354
|}
6455
""".stripMargin
6556
)
@@ -88,14 +79,10 @@ class RunScriptTests extends AnyWordSpec with Matchers {
8879
scriptFile,
8980
s"""
9081
|@main def foo() = {
91-
| val fw = new java.io.FileWriter("$escScriptPath", true)
92-
| fw.write("foo was called")
93-
| fw.close()
82+
| "foo was called" #> "$escScriptPath"
9483
|}
9584
|@main def bar() = {
96-
| val fw = new java.io.FileWriter("$escScriptPath", true)
97-
| fw.write("bar was called")
98-
| fw.close()
85+
| "bar was called" #> "$escScriptPath"
9986
|}
10087
""".stripMargin
10188
)
@@ -116,9 +103,7 @@ class RunScriptTests extends AnyWordSpec with Matchers {
116103
scriptFile,
117104
s"""
118105
|//> using file $additionalImportFile
119-
|val fw = new java.io.FileWriter("$escScriptPath", true)
120-
|fw.write(sayHello("michael")) //function defined in additionalImportFile
121-
|fw.close()
106+
|sayHello("michael") #> "$escScriptPath"
122107
""".stripMargin
123108
)
124109

@@ -137,9 +122,7 @@ class RunScriptTests extends AnyWordSpec with Matchers {
137122
Files.writeString(
138123
scriptFile,
139124
s"""
140-
|val fw = new java.io.FileWriter("$escScriptPath", true)
141-
|fw.write(sayHello("michael")) //function defined in additionalImportFile
142-
|fw.close()
125+
|sayHello("michael") #> "$escScriptPath"
143126
""".stripMargin
144127
)
145128

project/Versions.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ object Versions {
3131
val requests = "0.8.0"
3232
val scalaParallel = "1.0.4"
3333
val scalaParserCombinators = "2.4.0"
34-
val scalaReplPP = "0.5.4"
34+
val scalaReplPP = "0.6.1"
3535
val scalatest = "3.2.18"
3636
val scopt = "4.1.0"
3737
val semverParser = "0.0.6"

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.11.2
1+
sbt.version=1.11.3

0 commit comments

Comments
 (0)