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

More robust import tests #131

Merged
merged 1 commit into from
May 30, 2024
Merged

More robust import tests #131

merged 1 commit into from
May 30, 2024

Conversation

arduano
Copy link
Collaborator

@arduano arduano commented May 9, 2024

More robust import tests

Everything I've done in previous PRs fixed issues with these tests. They test importing both using paths and strings, importing from the same folder, from a parent folder, from a child folder.

@@ -0,0 +1,4 @@
{
dataPath = (builtins.import ./nested/basic.nix).data;
dataString = (builtins.import "./nested/basic.nix").data;
Copy link
Owner

Choose a reason for hiding this comment

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

Looks like imports with relative paths as strings is not supported in nix:

% nix eval -f child-folder-import.nix     
error:
       … while evaluating the attribute 'dataString'

         at /home/mat/git/rix/src/tests/import_tests/child-folder-import.nix:3:3:

            2|   dataPath = (builtins.import ./nested/basic.nix).data;
            3|   dataString = (builtins.import "./nested/basic.nix").data;
             |   ^
            4| }

       … while calling the 'import' builtin

         at /home/mat/git/rix/src/tests/import_tests/child-folder-import.nix:3:17:

            2|   dataPath = (builtins.import ./nested/basic.nix).data;
            3|   dataString = (builtins.import "./nested/basic.nix").data;
             |                 ^
            4| }

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: string './nested/basic.nix' doesn't represent an absolute path

@urbas
Copy link
Owner

urbas commented May 15, 2024

Looks great. The only thing needed is to convert the "importing with relative paths as strings" tests. These tests should produce an import error, so could you please assert that the error is thrown?

Everything I've done in previous PRs fixed issues with these tests. They test importing both using paths and strings, importing from the same folder, from a parent folder, from a child folder.
@arduano arduano merged commit cb390bc into master May 30, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants