Skip to content

Commit 9b736e2

Browse files
committed
syntax tests: add test for importing from non-existing files in libraries
1 parent 2c9b291 commit 9b736e2

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright © SixtyFPS GmbH <[email protected]>
2+
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-2.0 OR LicenseRef-Slint-Software-3.0
3+
4+
import { LibraryType } from "@test-lib/lib.slint";
5+
6+
import { NotFound } from "@not-found/foo.slint";
7+
// ^error{Cannot find requested import "@not-found/foo.slint" in the library search path}
8+
9+
import { NotFound2 } from "@test-lib/lib.slint";
10+
// ^error{No exported type called 'NotFound2' found in "@test-lib/lib.slint"}
11+
import { NotFound3 } from "@test-lib/not-existing.slint";
12+
// ^error{Cannot find requested import "@test-lib/not-existing.slint" in the library search path}
13+
14+
import { NotFound4 } from "@notexist";
15+
// ^error{Cannot find requested import "@notexist" in the library search path}
16+

internal/compiler/tests/syntax_tests.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,12 @@ fn process_file_source(
287287
let mut compiler_config = i_slint_compiler::CompilerConfiguration::new(
288288
i_slint_compiler::generator::OutputFormat::Interpreter,
289289
);
290+
compiler_config.library_paths = [(
291+
"test-lib".into(),
292+
concat!(env!("CARGO_MANIFEST_DIR"), "/tests/typeloader/library").into(),
293+
)]
294+
.into_iter()
295+
.collect();
290296
compiler_config.embed_resources = i_slint_compiler::EmbedResourcesKind::OnlyBuiltinResources;
291297
compiler_config.enable_experimental = true;
292298
compiler_config.style = Some("fluent".into());

0 commit comments

Comments
 (0)