malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
2.01k stars 76 forks source link

Add dimensional tests to Blueprint DSL #1894

Closed christopherswenson closed 2 months ago

christopherswenson commented 2 months ago

Replaces https://github.com/malloydata/malloy/pull/1891

Adds the ability to include test cases in dialect function definitions, e.g.:

const date_format: DefinitionBlueprint = {
  ...
  tests: [
    [
      'date_format(@2024-09-05 17:03:55, "%Y-%m-%d %H:%i:%S")',
      '2024-09-05 17:03:55',
    ],
  ],
};

As mentioned in https://github.com/malloydata/malloy/pull/1891, this only works for dimensional tests, as aggregate and window function tests are more complicated. I'm looking into making something that works for those, too.