mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-11 18:58:24 +03:00
Fix bug in expect test
This commit is contained in:
parent
705ce10085
commit
304b88cdb2
@ -101,14 +101,14 @@ pub fn load_and_monomorphize_from_str<'a>(
|
||||
exposed_types: ExposedByModule,
|
||||
roc_cache_dir: RocCacheDir<'_>,
|
||||
load_config: LoadConfig,
|
||||
) -> Result<MonomorphizedModule<'a>, LoadingProblem<'a>> {
|
||||
) -> Result<MonomorphizedModule<'a>, LoadMonomorphizedError<'a>> {
|
||||
use LoadResult::*;
|
||||
|
||||
let load_start = LoadStart::from_str(arena, filename, src, roc_cache_dir, src_dir)?;
|
||||
|
||||
match load(arena, load_start, exposed_types, roc_cache_dir, load_config)? {
|
||||
Monomorphized(module) => Ok(module),
|
||||
TypeChecked(_) => unreachable!(""),
|
||||
TypeChecked(module) => Err(LoadMonomorphizedError::ErrorModule(module)),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bumpalo::Bump;
|
||||
use roc_load::{ExecutionMode, LoadConfig, Threading};
|
||||
use roc_load::{ExecutionMode, LoadConfig, LoadMonomorphizedError, Threading};
|
||||
use roc_packaging::cache::{self, RocCacheDir};
|
||||
use roc_problem::Severity;
|
||||
use roc_reporting::report::Palette;
|
||||
@ -73,7 +73,13 @@ pub fn compile_to_mono<'a, 'i, I: Iterator<Item = &'i str>>(
|
||||
|
||||
let mut loaded = match loaded {
|
||||
Ok(v) => v,
|
||||
Err(LoadingProblem::FormattedReport(report)) => {
|
||||
Err(LoadMonomorphizedError::ErrorModule(m)) => {
|
||||
todo!(
|
||||
"error while loading module: {:?}",
|
||||
(m.can_problems, m.type_problems)
|
||||
);
|
||||
}
|
||||
Err(LoadMonomorphizedError::LoadingProblem(LoadingProblem::FormattedReport(report))) => {
|
||||
return (
|
||||
None,
|
||||
Problems {
|
||||
|
@ -87,7 +87,7 @@ mod test {
|
||||
use indoc::indoc;
|
||||
use pretty_assertions::assert_eq;
|
||||
use roc_gen_llvm::{llvm::build::LlvmBackendMode, run_roc::RocCallResult, run_roc_dylib};
|
||||
use roc_load::{ExecutionMode, LoadConfig, Threading};
|
||||
use roc_load::{ExecutionMode, LoadConfig, LoadMonomorphizedError, Threading};
|
||||
use roc_packaging::cache::RocCacheDir;
|
||||
use roc_reporting::report::{RenderTarget, DEFAULT_PALETTE};
|
||||
use target_lexicon::Triple;
|
||||
@ -119,7 +119,7 @@ mod test {
|
||||
threading: Threading::Single,
|
||||
exec_mode: ExecutionMode::Test,
|
||||
};
|
||||
let loaded = roc_load::load_and_monomorphize_from_str(
|
||||
let loaded = match roc_load::load_and_monomorphize_from_str(
|
||||
arena,
|
||||
filename,
|
||||
source,
|
||||
@ -127,8 +127,13 @@ mod test {
|
||||
Default::default(),
|
||||
RocCacheDir::Disallowed,
|
||||
load_config,
|
||||
)
|
||||
.unwrap();
|
||||
) {
|
||||
Ok(m) => m,
|
||||
Err(LoadMonomorphizedError::ErrorModule(m)) => {
|
||||
panic!("{:?}", (m.can_problems, m.type_problems))
|
||||
}
|
||||
Err(e) => panic!("{e:?}"),
|
||||
};
|
||||
|
||||
let mut loaded = loaded;
|
||||
let mut expectations = std::mem::take(&mut loaded.expectations);
|
||||
@ -442,8 +447,8 @@ mod test {
|
||||
main = 0
|
||||
|
||||
expect
|
||||
vec1 = { x: 1.0f64, y: 2.0f64 }
|
||||
vec2 = { x: 4.0f64, y: 8.0f64 }
|
||||
vec1 = { x: 1u8, y: 2u8 }
|
||||
vec2 = { x: 4u8, y: 8u8 }
|
||||
|
||||
vec1 == vec2
|
||||
"#
|
||||
@ -453,17 +458,17 @@ mod test {
|
||||
This expectation failed:
|
||||
|
||||
5│> expect
|
||||
6│> vec1 = { x: 1.0f64, y: 2.0f64 }
|
||||
7│> vec2 = { x: 4.0f64, y: 8.0f64 }
|
||||
6│> vec1 = { x: 1u8, y: 2u8 }
|
||||
7│> vec2 = { x: 4u8, y: 8u8 }
|
||||
8│>
|
||||
9│> vec1 == vec2
|
||||
|
||||
When it failed, these variables had these values:
|
||||
|
||||
vec1 : { x : F64, y : F64 }
|
||||
vec1 : { x : U8, y : U8 }
|
||||
vec1 = { x: 1, y: 2 }
|
||||
|
||||
vec2 : { x : F64, y : F64 }
|
||||
vec2 : { x : U8, y : U8 }
|
||||
vec2 = { x: 4, y: 8 }
|
||||
"#
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user