Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impose an ordering on the specification #71

Open
samwyse opened this issue Sep 4, 2013 · 2 comments
Open

Impose an ordering on the specification #71

samwyse opened this issue Sep 4, 2013 · 2 comments
Labels
infrastructure structural changes not affecting test content

Comments

@samwyse
Copy link

samwyse commented Sep 4, 2013

When studying a specification, it is helpful if the various portions have a natural ordering, such that each portion only depends upon the successful understanding (or implementation) of the preceding portions, and not on the implementation of any succeeding portions. Unfortunately, there is a dependency loop between the 'interpolation' and 'sections' portions of the specification. Specifically, the five tests 'Dotted Names - Basic Interpolation', 'Dotted Names - Triple Mustache Interpolation', 'Dotted Names - Ampersand Interpolation', 'Dotted Names - Initial Resolution' and 'Dotted Names - Context Precedence' of the 'interpolation' portion assume that the 'sections' portion has been implemented. These tests should be moved to the 'sections' portion. Modified versions of the first three can left in the 'interpolation' portion by making them more like the Dotted Names - Arbitrary Depth interpolation test.

Once the portions can be ordered, it would also be helpful to include information about that in the specification itself, by adding a key to the top level. Several possible names suggest themselves for this key; I will use 'depends_upon' but 'assumes', 'requires' or 'uses' would also be good names.

The 'interpolation' portion, being the base, would include this:

depends_upon: []

The 'comments' and 'sections' specs would include this:

depends_upon: ['interpolation']

The 'delimiters', 'inverted' and 'partials' portions would include this:

depends_upon: ['sections']

Finally, the '~lambdas' portion would include this:

depends_upon: ['inverted']

With this in place, a topological sort will produce an ordering. Note that each section defines a list of prerequisites, even though the current specs only demand one each; also note that although a topological sort can figure things out, you may want to include all prerequisites in the list, not just the immediate predecessor.

@samwyse
Copy link
Author

samwyse commented Sep 4, 2013

I've forked a copy of the spec and implemented my suggestions here: https://github.com/samwyse/spec

@jgonggrijp jgonggrijp added the infrastructure structural changes not affecting test content label Nov 6, 2023
@jgonggrijp
Copy link
Member

I like the idea of turning the tests into a directed acyclic graph (DAG). Please feel welcome to create a pull request that does this for the current version of the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
infrastructure structural changes not affecting test content
Projects
None yet
Development

No branches or pull requests

2 participants