UNPKG

meld-spec

Version:

Specification for the Meld scripting language

165 lines (164 loc) 4.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runTests = void 0; /** * Test cases for the @run directive that all implementations must pass */ exports.runTests = [ // Basic command { name: 'basic-command', input: '@run [echo "hello"]', expected: { type: 'Directive', directive: { kind: 'run', command: 'echo "hello"' } }, description: 'Basic command with quoted string' }, // Command with spaces and different quotes { name: 'command-with-quotes', input: '@run [echo "double" \'single\' `backtick`]', expected: { type: 'Directive', directive: { kind: 'run', command: 'echo "double" \'single\' `backtick`' } }, description: 'Command with different types of quotes' }, // Command with text variable { name: 'command-with-text-var', input: '@run [echo ${message}]', expected: { type: 'Directive', directive: { kind: 'run', command: 'echo ${message}' } }, description: 'Command with text variable interpolation' }, // Command with path variable { name: 'command-with-path-var', input: '@run [cat $file]', expected: { type: 'Directive', directive: { kind: 'run', command: 'cat $file' } }, description: 'Command with path variable' }, // Command with special path variables { name: 'command-with-home-path', input: '@run [ls $HOMEPATH/docs]', expected: { type: 'Directive', directive: { kind: 'run', command: 'ls $HOMEPATH/docs' } }, description: 'Command with HOMEPATH variable' }, { name: 'command-with-home-alias', input: '@run [ls $~/docs]', expected: { type: 'Directive', directive: { kind: 'run', command: 'ls $~/docs' } }, description: 'Command with ~ alias for HOMEPATH' }, { name: 'command-with-project-path', input: '@run [ls $PROJECTPATH/src]', expected: { type: 'Directive', directive: { kind: 'run', command: 'ls $PROJECTPATH/src' } }, description: 'Command with PROJECTPATH variable' }, { name: 'command-with-project-alias', input: '@run [ls $./src]', expected: { type: 'Directive', directive: { kind: 'run', command: 'ls $./src' } }, description: 'Command with . alias for PROJECTPATH' }, // Command with nested brackets { name: 'command-with-brackets', input: '@run [echo [nested] brackets]', expected: { type: 'Directive', directive: { kind: 'run', command: 'echo [nested] brackets' } }, description: 'Command with nested brackets treated as text' }, // Command with header { name: 'command-with-header', input: '@run [echo "hello"] under Output', expected: { type: 'Directive', directive: { kind: 'run', command: 'echo "hello"', underHeader: 'Output' } }, description: 'Command with output under header' }, // Command reference with parameters { name: 'command-reference', input: '@run [$greet(${name}, ${message})]', expected: { type: 'Directive', directive: { kind: 'run', command: '$greet(${name}, ${message})', isReference: true } }, description: 'Command reference with parameters' }, // Complex command with multiple features { name: 'complex-command', input: '@run [curl -H "Authorization: Bearer ${TOKEN}" $PROJECTPATH/api/${endpoint}] under API Response', expected: { type: 'Directive', directive: { kind: 'run', command: 'curl -H "Authorization: Bearer ${TOKEN}" $PROJECTPATH/api/${endpoint}', underHeader: 'API Response' } }, description: 'Complex command with variables, paths, and header' } ];