Tk Source Code

View Ticket
Login
Ticket UUID: a9ff2c73ca944ba045d5daff18828a1cdeeefb12
Title: Assorted issues remaining from previous test suite projects
Type: RFE Version: 9.0 + 9.1
Submitter: erikleunissen Created on: 2025-11-19 12:56:03
Subsystem: 99. Other Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2026-01-13 12:29:59
Resolution: Accepted Closed By: erikleunissen
    Closed on: 2026-01-13 12:29:59
Description:
During the previous projects related to the Tk test suite* several smaller
issues were encountered that didn't quite match the purpose of any of these
projects, or they were simply overlooked there. The nature of these issues
varies and regards inconsistencies across test files, incompleteness and
inefficiencies.

This ticket addresses all these issues.

Development takes place in branch "remaining_test_suite_issues", see:

    [https://core.tcl-lang.org/tk/timeline?r=remaining_test_suite_issues]

--
*  "Collect test utilities", "Uniform test file structure",
   "Simplify test file initialization" and "Skip entire test file".
User Comments: erikleunissen added on 2026-01-13 12:29:59:
Merged the development branch into trunk and core-9-0-branch.
Closing the ticket now.

erikleunissen added on 2025-12-09 09:28:55:
FINAL REVIEW
============

This project is in the stage of a final review.

Useful info for reviewers:
* the previous post in this ticket holds a summary of the project's results.

* the complete diff w.r.t. trunk for this project is here:

        [https://core.tcl-lang.org/tk/vdiff?branch=remaining_test_suite_issues]

* the timeline of the development branch for this project is here:

        [https://core.tcl-lang.org/tk/timeline?r=remaining_test_suite_issues]

* the current tip of the development branch may be used for exercising. It has
  been tagged "FINAL_REVIEW" (tag propagates).

* The results of Tk test suite runs on Github CI are here:

        [https://github.com/tcltk/tk/actions?query=branch%3Aremaining_test_suite_issues]

Please leave your responses in this ticket or direct them to the TCLCORE mailing
list before Tuesday 16-dec-2025 24:00 UTC.

Thanks in advance,
Erik Leunissen

erikleunissen added on 2025-12-08 22:11:27:
SUMMARY OF PROJECT RESULTS
==========================

A. Changes applied throughout the Tk test suite
   * conversion of "==" to "eq" if string comparison is intended
   * enclose [expr] expressions in braces, except where this was not intended

B. Changes to the ttk test suite
   * add a note to each ttk widget test file, warning against using the tcltest
     options "-match", "-skip" and "limitconstraints 1" in invocations of the
     ttk test suite.

C. Several small and specific changes that defy summarization

erikleunissen added on 2025-12-03 14:41:57:
ABANDONING FURTHER EFFORTS REGARDING TEST FILE STRUCTURE FOR TTK
================================================================

The ttk test suite holds many test files that perform a setup or cleanup for
a contiguous group of tests. These tests often have no explicit expected
result. They return an empty string, either implicitly or explicitly by using
a final "return" statement. See for example:

    [https://core.tcl-lang.org/tk/file?ci=7e83023ae42414d7&name=tests%2Fttk%2Fentry.test&ln=42-88]

Initially I thought of these tests as incidental mistakes, because they subvert
the (recommended) possibility to run tests selectively/individually using the
tcltest options "-match", "-skip" and/or "-limitconstraints 1". See for example
how this invocation leads to a test failure for the ttk test (but not for the
corresponding test for the core Tk entry):

    TESTFLAGS="-file entry.test -match entry-1.2" make test

or worse:

    TESTFLAGS="-file entry.test -skip entry-1.1" make test

Therefore, I started out to convert these cases to proper COMMON TEST SETUP and
COMMON TEST CLEANUP sections. However, while underway in this proces, I learned
that the original test author uses such "fake" tests systematically. This made me
reluctant to proceed with my effort.

Moreover, I discovered that many tests within such contiguous groups, build
upon each other, introducing yet another level of test interdependence. See
for example:

    [https://core.tcl-lang.org/tk/file?ci=7e83023ae42414d7&name=tests%2Fttk%2Fentry.test&ln=125-179]

I'm concluding that:
* the ttk tests were not designed with test-independence in mind. The original
  test author was fully aware of the test dependencies that were introduced,
  and he shaped the tests accordingly/intentionally.
* making all ttk tests independent from each-other (and hence departing from the
  design principle of the original test author), would encompass an effort that
  goes substantially further than systematically provisioning proper
  COMMON TEST SETUP/CLEANUP sections. Therefore, it's not a feasible task for me.
* doing this only for the so-called "setup tests" and "cleanup tests" would
  intrude substantially on the design principle of the original test author
  while leaving part of the issue unaddressed. It would therefore appear to be
  a job that is only half-done.

Therefore, I'm now withdrawing entirely from my effort. I will revert any
previous commits of mine that addressed such tests, including some that belong
to the previous Tk test suite project "uniform_test_file_structure".

Note that this decision does not concern the main test file sections
TESTFILE INITIALIZATION, TESTFILE CLEANUP, and the sections LOCAL UTILITY PROCS
and LOCAL TEST CONSTRAINTS at the start of a test file. These sections headers
will remain.

To document the situation for future test authors, I'm going to add a note to
a NOTES section in each ttk test file, explaining the consequences for using
the tcltest options "-match", "-skip" and/or "-limitconstraints 1".