[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.lisp

load resources (files) for tests

Jacek Grzebyta

9/1/2015 11:57:00 PM



Dear All,

I need to run tests (lisp-unit2 package) on sometimes quite long strings
which should be kept as a separate text files.
For that purpose I even wrote a function which loads input stream into string.
However I have problem with loading the file (or having the path at least).
In Java I was able to load the data file either by finding the absolute path
of the test file and further load a data file using the relational path to
the test class. Second option was using built-in ResourceLoader.
In that case File("src/test/resources/config.ttl") started searching the file
in relation to the application root.

How to do it in Common Lisp (SBCL)? I tested sb-posix:getcwd method but it
shows the current path really. Maybe I am wrong and having that feature is
not necessary at all?

I would be grateful for your help.

Best wishes,
Jacek
7 Answers

Dimitri Fontaine

9/2/2015 8:04:00 AM

0

Jacek Grzebyta <jgrzebyta@users.sourceforge.net> writes:
> For that purpose I even wrote a function which loads input stream into string.
> However I have problem with loading the file (or having the path at least).

I use asdf:system-relative-pathname to that effect.

Regards,
--
dim

smh

9/2/2015 11:03:00 AM

0

Depending on the details, the standard ANSI CL function enough-namestring might be useful.

Unfortunately, the behavior of CL pathname functions is (in any practical sense) rather underspecified because there are so many filesystem platforms with various quirks, some of which (both filesystems and quirks!) didn't even exist when the ANS was finalized.

Zach Beane

9/2/2015 11:38:00 AM

0

smh <shaflich@gmail.com> writes:

> Depending on the details, the standard ANSI CL function
> enough-namestring might be useful.
>
> Unfortunately, the behavior of CL pathname functions is (in any
> practical sense) rather underspecified because there are so many
> filesystem platforms with various quirks, some of which (both
> filesystems and quirks!) didn't even exist when the ANS was finalized.

There were more filesystems then. There are fewer now.

Zach

Jacek Grzebyta

9/2/2015 12:36:00 PM

0

Dimitri Fontaine <dim@tapoueh.org> writes:

> Jacek Grzebyta <jgrzebyta@users.sourceforge.net> writes:
>> For that purpose I even wrote a function which loads input stream into string.
>> However I have problem with loading the file (or having the path at least).
>
> I use asdf:system-relative-pathname to that effect.
>
> Regards,

That is what I needed. Thanks very much.

Jacek

Rainer Joswig

9/2/2015 1:52:00 PM

0

Am Mittwoch, 2. September 2015 13:37:56 UTC+2 schrieb Zach Beane:

> There were more filesystems then. There are fewer now.

https://en.wikipedia.org/wiki/Comparison_of_fi...

Paul Wallich

9/2/2015 2:43:00 PM

0

On 9/2/15 9:51 AM, Rainer Joswig wrote:
> Am Mittwoch, 2. September 2015 13:37:56 UTC+2 schrieb Zach Beane:
>
>> There were more filesystems then. There are fewer now.
>
> https://en.wikipedia.org/wiki/Comparison_of_fi...

Or at least fewer necessary filesystem APIs. There's all manner of
completely weird stuff out there (distributed, journalled, leveling,
emulated usw) but pretty much all of it has a layer that lets you
address the thing you want by one of a couple of standard names.

Which for Lisp's purposes is generally what you care about.

paul

Marco Antoniotti

9/2/2015 3:00:00 PM

0

On Wednesday, September 2, 2015 at 5:43:32 PM UTC+3, paul wallich wrote:
> On 9/2/15 9:51 AM, Rainer Joswig wrote:
> > Am Mittwoch, 2. September 2015 13:37:56 UTC+2 schrieb Zach Beane:
> >
> >> There were more filesystems then. There are fewer now.
> >
> > https://en.wikipedia.org/wiki/Comparison_of_fi...
>
> Or at least fewer necessary filesystem APIs. There's all manner of
> completely weird stuff out there (distributed, journalled, leveling,
> emulated usw) but pretty much all of it has a layer that lets you
> address the thing you want by one of a couple of standard names.
>
> Which for Lisp's purposes is generally what you care about.
>

In my dabbling with pathnames I came up (a long time a ago) with this semi-spec.

http://bimib.disco.unimib.it/people/Marco.Antoniotti/Projects/CL/...

I deliberately inserted a couple of necessary restrictions on possible implementations of such spec. See the bottom of the page note in http://bimib.disco.unimib.it/people/Marco.Antoniotti/Projects/CL/...parse-namestring-function.html

Cheers
--
MA