Skip to content

Commit

Permalink
Make execution mode live default for CLI (#6496)
Browse files Browse the repository at this point in the history
As requested in the design doc and in the ticket.

Closes #6495.
  • Loading branch information
hubertp authored May 2, 2023
1 parent d6fa36d commit 7e33300
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion engine/runner/src/main/scala/org/enso/runner/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ object Main {
.numberOfArgs(1)
.argName("name")
.desc(
"Execution environment to use during execution (`live`/`design`). Defaults to `design`."
"Execution environment to use during execution (`live`/`design`). Defaults to `live`."
)
.build()

Expand Down Expand Up @@ -1109,6 +1109,7 @@ object Main {
line.hasOption(INSPECT_OPTION),
line.hasOption(DUMP_GRAPHS_OPTION),
Option(line.getOptionValue(EXECUTION_ENVIRONMENT_OPTION))
.orElse(Some("live"))
)
}
if (line.hasOption(REPL_OPTION)) {
Expand Down
7 changes: 5 additions & 2 deletions test/Tests/src/Semantic/Runtime_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,19 @@ spec =
x = Runtime.no_inline_with_arg (x -> x + 4) 3
x . should_equal 7
Test.group "Contexts and Execution Environment" <|
Test.specify "should prevent execution in the default design environment" <|
Test.specify "should not prevent execution in the default live environment" <|
res = Panic.catch Any (in_fn 1) p-> p.payload.to_text
res . should_equal 2
Test.specify "should prevent execution with explicitly disabled context" <|
res = Panic.catch Any (Runtime.with_disabled_context Input environment=Runtime.current_execution_environment (in_fn 1)) p-> p.payload.to_text
res . should_equal "(Forbidden_Operation.Error 'Input')"
Test.specify "should be configurable" <|
r1 = Runtime.with_enabled_context Input environment=Runtime.current_execution_environment <|
Runtime.with_enabled_context Output environment=Runtime.current_execution_environment <|
in_fn (out_fn 10)
r1.should_equal 22

r2 = Panic.catch Any (Runtime.with_enabled_context Output environment=Runtime.current_execution_environment <| in_fn (out_fn 10)) p-> p.payload.to_text
r2 = Panic.catch Any (Runtime.with_disabled_context Input environment=Runtime.current_execution_environment <| in_fn (out_fn 10)) p-> p.payload.to_text
r2 . should_equal "(Forbidden_Operation.Error 'Input')"

main = Test_Suite.run_main spec

0 comments on commit 7e33300

Please sign in to comment.