Enable Enso asserts on CI (#7929)

---------

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Pavel Marek 2023-10-04 15:52:44 +02:00 committed by GitHub
parent 997e0fc465
commit c525698e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 0 deletions

View File

@ -1,6 +1,7 @@
use crate::prelude::*;
use crate::paths::Paths;
use crate::paths::ENSO_ENABLE_ASSERTIONS;
use crate::paths::ENSO_META_TEST_ARGS;
use crate::paths::ENSO_META_TEST_COMMAND;
use crate::postgres;
@ -119,6 +120,8 @@ impl BuiltEnso {
ENSO_META_TEST_COMMAND.set(&self.wrapper_script_path())?;
ENSO_META_TEST_ARGS.set(&format!("{} --run", ir_caches.flag()))?;
ENSO_ENABLE_ASSERTIONS.set("true")?;
// Prepare Engine Test Environment
if let Ok(gdoc_key) = std::env::var("GDOC_KEY") {
let google_api_test_data_dir =

View File

@ -29,6 +29,9 @@ ide_ci::define_env_var! {
/// Arguments to the engine runner.
/// See: <https://github.com/diab0l/enso/blob/feature/test_with_clue/test/Meta_Test_Suite_Tests/README.md>
ENSO_META_TEST_ARGS, String;
/// If Enso-specific assertions should be enabled.
ENSO_ENABLE_ASSERTIONS, String;
}
pub const EDITION_FILE_ARTIFACT_NAME: &str = "Edition File";

View File

@ -65,6 +65,7 @@ import project.Network.Http_Spec
import project.Network.URI_Spec
import project.Runtime.Ascribed_Parameters_Spec
import project.Runtime.Asserts_Spec
import project.Runtime.Lazy_Spec
import project.Runtime.Lazy_Generator_Spec
import project.Runtime.Managed_Resource_Spec
@ -132,6 +133,7 @@ main = Test_Suite.run_main <|
Ref_Spec.spec
Regex_Spec.spec
Ascribed_Parameters_Spec.spec
Asserts_Spec.spec
Lazy_Spec.spec
Runtime_Spec.spec
Self_Type_Spec.spec

View File

@ -0,0 +1,27 @@
from Standard.Base import all
from Standard.Base.Errors.Common import Assertion_Error
from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions
foreign js js_check = """
return (4 == 2 + 2)
on_ci = if Environment.get "ENSO_RUNNER_CONTAINER_NAME" . is_nothing . not then Nothing else "Not in CI"
spec = Test.group "Asserts" pending=on_ci <|
Test.specify "should be enabled on the CI" <|
p = Panic.catch Assertion_Error (Runtime.assert False) err->
err.payload
Meta.type_of p . should_be_a Assertion_Error
Test.specify "should be able to take foreign functions as expressions" <|
ret = Runtime.assert js_check
ret . should_be_a Nothing
Test.specify "should be able to take lambdas as expressions" <|
Runtime.assert <|
4 == 2 + 2
main = Test_Suite.run_main spec