Project

General

Profile

Design #1496

Use "special" names for variables inside tests

Added by John Abbott over 3 years ago. Updated about 2 months ago.

Status:
Rejected
Priority:
Low
Assignee:
Category:
enhancing/improving
Target version:
Start date:
02 Oct 2020
Due date:
% Done:

100%

Estimated time:
1.11 h
Spent time:

Description

To avoid problems with name clashes the names of variables inside test scripts these variable should have "special" names (which are unlikely to clash).

Discuss, implement.


Related issues

Related to CoCoA-5 - Bug #1294: CoCoA-5 tests may fail even if executed correctlyClosed2019-06-06

History

#1 Updated by John Abbott over 3 years ago

  • Related to Bug #1294: CoCoA-5 tests may fail even if executed correctly added

#2 Updated by John Abbott over 3 years ago

COPIED FROM COMMENT 3 in #1294

One possibility is simply to use names which start with underscore: this is allowed and was used in CoCoA4 for something (hidden package values?).
Perhaps even double underscore? That would be quite unusual but not impinge too badly on readability.

It might be nicer to use names which depend on the test file: e.g. in exbugs.cocoa5 we could use names like exbug_f. This reduces the chance of a name clash, but also reduces readability.

#3 Updated by John Abbott over 3 years ago

Here is a list of the tests: we can remove the ones which have been checked/updated.

anna.cocoa5
AnonFunc.cocoa5
bug-EvalTwice.cocoa5
demo-GeMiTo2011.cocoa5
demo-Osaka2015.cocoa5
ErrMesg.cocoa5
exbugs.cocoa5
exsegv.cocoa5
ExtLibNORMALIZ.cocoa5
INACTIVE-packages.cocoa5
INACTIVE-parameters.cocoa5
INACTIVE-protection.cocoa5
lecture-HF1.cocoa5
lecture-HF2.cocoa5
lecture-HF3.cocoa5
lecture-HF4.cocoa5
primary.cocoa5
quine.cocoa5
radical0dim.cocoa5
radical.cocoa5
RealRoots.cocoa5
SourceAnna.cocoa5
tagging.cocoa5
test-ApproxSolve.cocoa5
test-FactorAlgExt.cocoa5
test-HomomorphismOps.cocoa5
test-implicit.cocoa5
test-manual.cocoa5
test-output.cocoa5
test-PrimaryDecomposition0.cocoa5
test-toric.cocoa5
tricky-references.cocoa5
tut-CoCoLA1.cocoa5
tut-CoCoLA2.cocoa5
tut-CoCoLA3.cocoa5
tut-CoCoLA4.cocoa5
TutHokkaido2.cocoa5
TutHokkaido3.cocoa5
TutHokkaido4.cocoa5
TutHokkaido5.cocoa5
whatiscocoa.cocoa5

#4 Updated by John Abbott over 2 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

I have decided to "test" the idea of putting a single underscore at the start of names.

I have just modified bug-EvalTwice.cocoa5 so that we can see how a test using "funny names" looks (and how readable it is).
Will check in shortly.

#5 Updated by John Abbott over 2 years ago

  • Priority changed from Normal to Low
  • Target version changed from CoCoA-5.4.0 to CoCoA-5.4.2
Anna is reasonably convinced by the idea. She made some alternative proposals:
  • use all capital letters for names which could in principle clash
  • use another prefix e.g. TEST_
  • change file names so that they are more uniform: e.g. prefixes such as Lecture, Test etc.

Priority is now low; target now 5.3.6.... this issue is not really urgent (no problems have ever been encountered).

#6 Updated by John Abbott about 2 months ago

  • % Done changed from 10 to 20

I originally created this issue, which superficially seems reasonable.
But now I no longer recall exactly which name clashes we wanted to avoid: maybe when there are several tests in one file (indeed this is the case for all the test files)?

I'm now inclined to ask: what's the point? The tests seems to behave as intended -- I do not recall an instance where a name clash caused trouble. So why invest time fixing a problem which seems not to exist?

#7 Updated by John Abbott about 2 months ago

  • Status changed from In Progress to Rejected
  • Assignee set to John Abbott
  • % Done changed from 20 to 100
  • Estimated time set to 1.11 h

After brief discussion with Anna: KISS -- it works without problem as is, so don't waste time fixing a problem which does not exist!
Rejecting!

Also available in: Atom PDF