Opened 11 years ago

Closed 11 years ago

#418 closed task (fixed)

create an init.sh to share code between tests written sh

Reported by: Peter Johansson Owned by: Peter Johansson
Priority: major Milestone: svndigest 0.8
Component: test Version: trunk
Keywords: Cc:

Description

Just like we have the test::Suite class for tests written in C++ it would be handy to have an init.sh that be called in the top of tests in order to init some variable and check VERBOSE env variable or -v switch et cetera.

The good thing is that we can avoid copy&paste, which is fine first time you write the test, but a pain the day you have to fix a bug in that code which pasted in multiple places. Another good thing is that we don't need configure to create every test.sh from a test.sh.in because all variables that are set by configure can be set in init.sh instead and shared between the tests. We only need one CONFIG_FILE that is init.sh.in. This is how it is done in the yat project.

The downside is that the tests will only be callable from one directory, which is $(top_builddir)/test because that is from where Automake calls the tests. How important is it that tests are callable from anywhere?

Btw, this ticket was triggered from when I was working on extending the test of svndigest-copy-cache (#380)

Change History (5)

comment:1 Changed 11 years ago by Peter Johansson

Status: newassigned

No feedback, so I suppose it's green light.

comment:2 Changed 11 years ago by Jari Häkkinen

I missed this ticket but I have no comments so fly away.

comment:3 Changed 11 years ago by Peter Johansson

This involved renaming a couple of foo.sh.in to foo.sh which will cause svn to complain that foo.sh already exists. I could avoid that by renaming to bar.sh instead. Opinions?

comment:4 Changed 11 years ago by Peter Johansson

(In [952]) introducing init.sh and using it. Added a README file in test directory including info on how to use init.sh. refs #418

comment:5 Changed 11 years ago by Peter Johansson

Resolution: fixed
Status: assignedclosed

(In [955]) closes #418

Note: See TracTickets for help on using tickets.