Make execution mode live default for CLI (#6496)

As requested in the design doc and in the ticket.

Closes #6495.
This commit is contained in:
Hubert Plociniczak 2023-05-02 11:58:41 +02:00 committed by GitHub
parent d6fa36d793
commit 7e33300013
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -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()
@ -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)) {

View File

@ -23,8 +23,11 @@ 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 <|
@ -32,7 +35,7 @@ spec =
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