Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable Enso asserts on CI #7929

Merged
merged 7 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/build/src/enso.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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".to_string())?;

// Prepare Engine Test Environment
if let Ok(gdoc_key) = std::env::var("GDOC_KEY") {
let google_api_test_data_dir =
Expand Down
3 changes: 3 additions & 0 deletions build/build/src/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
27 changes: 27 additions & 0 deletions test/Tests/src/Runtime/Asserts_Spec.enso
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from Standard.Base import all

from Standard.Base.Errors.Common import Assert_Error

from Standard.Test import Test, Test_Suite
import Standard.Test.Extensions

foreign js js_check = """
4 == 2 + 2

on_ci = if env.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 Assert_Error (Runtime.assert False) err->
err.payload
Meta.type_of p . should_be Assert_Error

Test.specify "should be able to take foreign functions as expressions" <|
ret = Runtime.assert js_check
ret . should_be Nothing

Test.specify "should be able to take lambdas as expressions" <|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also an assertion failure test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's very basic, but there are many other tests in engine.

Runtime.assert <|
4 == 2 + 2

main = Test_Suite.run_main spec
Loading