[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] Need help understanding "include" behaviour
From: |
Bahman Movaqar |
Subject: |
Re: [Chicken-users] Need help understanding "include" behaviour |
Date: |
Mon, 15 Dec 2014 00:02:20 +0330 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
On 12/14/2014 10:19 PM, John Cowan wrote:
> Bahman Movaqar scripsit:
>
>> (use test)
>> (load "../misc")
>> (import misc)
>> (test-group "misc"
>> ...
>>
>> However when running `chicken-install -test` I get the following error:
>> Error: (import) during expansion of (import ...) - cannot import
>> from undefined module: misc
> When you aren't in the same directory, the misc.import.scm/.so can't
> be found, which is why the module can't be imported. If you put the
> test files in the same directory as the main code, then you can just
> (use misc).
Does that mean that there's no way to have tests in the separate
directory or does it require special trickery?
>> Now if I move the (load) and (import) expressions from "misc-tests" to
>> "run", everything works fine. What's the logic behind this behaviour of
>> "include" [1]? I'd appreciate if someone would shed a light on this.
> Essentially, "include" happens at compile time: it is a macro that
> directly incorporates the file you mentioned. "Load" is a run-time
> operation. Note that since you are including your individual test file,
> there is no need to "use test" a second time.
Thanks for the information. But I still don't understand why moving
(load) and (import) to "run.scm" makes things work? :-)
--
Bahman Movaqar
http://BahmanM.com - https://twitter.com/bahman__m
https://github.com/bahmanm - https://gist.github.com/bahmanm
PGP Key ID: 0x6AB5BD68 (keyserver2.pgp.com)
signature.asc
Description: OpenPGP digital signature