GithubHelp home page GithubHelp logo

spt's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spt's Issues

Confusing string escape semantics

The semantics of string escapes is confusing (to me) when specifying test expectations.

test stringescape [[ "" ]] parse to Mod(String("\"\""))

This test succeeds as expected.

test stringescape [[ "\"" ]] parse to Mod(String("\"\\\"\""))

This test fails unexpectedly. I checked the expected string by printing the input program in ATerm format, which prints the same string as in the expected test result.

The test passes when I delete one of the triplet of backslashes:

test stringescape [[ "\"" ]] parse to Mod(String("\"\\"\""))

The error message was not very helpful as it does not correctly print the expected result, not does the parse result it contains match the 'fixed' test result:

The fragment did not parse to the expected ATerm. Parse result was: Mod(String("\"\\\"\"")) Expected result was: Mod(String(\"\\\\\"\"))

Test description does not parse when it contains a single open square bracket

Summary
According to the documentation, a single open square bracket ([) is allowed in test descriptions as it is not a marker. However, it does not work: the file fails to parse.

Todo

  • Create syntax tests with a single open square bracket in the description
  • Fix bug (see 'implementation details' below)

Reproduction steps
Given: An example test case from PIE, but it should happen with any language:

test name ends with [ [[ data Foo[ = foreign java org.example.test.Foo {} ]] parse fails

Expected: The SPT file parses
Actual: The SPT file does not parse, error at the first [: Syntax error, not expected here: '['

Implementation details
This is caused by line 137 of the grammar: Description = (~[\n\r\[])+
It does not allow any open square brackets in the description, while it should allow one.
This could be resolved by making a special case for a single [:

Description = (~[\n\r\[]|\[~[\[])+

Note: I am not completely sure that this will work as is

Support run strategy with term args to aterm

Currently you can write a test expectation run my-test-strat(|"some term args", 1) to [[ my language snippet ]] but not run my-test-strat(|"some term args", 1) to MyATerm(Expectation("hi?")) (or rather, the latter gets interpreted as a run expectation + a parse-to expectation).

Support specification of multiple files in a single SPT test case

Many languages allow programs to import programs from other files. To test things related to importing other files, you need to be able to specify multiple files in a single test case. However, currently you can specify at most one full program (file) in a single SPT test case. So, testing the import feature of languages is not possible with SPT.

A current workaround is adding a language construct to your language that replicates the start of a new file in a single file, but that workaround changes the grammar of a language purely for testing which is not tenable.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.