diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-08-04 23:40:12 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-08-04 23:40:12 +0200 |
commit | da135c09210105ef11e8c096f23f3ffc125b7f60 (patch) | |
tree | 7321ee6ef1c7f9357964ff816f7970bf6e31f2a1 | |
parent | bd5414ecb2cfa9c22ad18f925a53d76dc10cc413 (diff) |
Co-authored-by: Luca Matei Pintilie <luca@lucamatei.com>
-rwxr-xr-x | tests | 92 |
1 files changed, 92 insertions, 0 deletions
@@ -0,0 +1,92 @@ +#!/bin/sh + +fail() { + echo "$1" >&2 + exit 1 +} + +testmmv() { + DIR=test-mmv + mkdir -p $DIR + touch \ + $DIR/bytecodeVm.c \ + $DIR/fastLexer.c \ + $DIR/fastLexer.h \ + $DIR/slowParser.c \ + $DIR/slowParser.h + ls $DIR/*.[ch] | mmv sed 's/[A-Z]/\L-&/g' + >/dev/null ls \ + $DIR/bytecode-vm.c \ + $DIR/fast-lexer.c \ + $DIR/fast-lexer.h \ + $DIR/slow-parser.c \ + $DIR/slow-parser.h \ + || fail 'Missing lispcase files' + 2>/dev/null ls \ + $DIR/bytecodeVm.c \ + $DIR/fastLexer.c \ + $DIR/fastLexer.h \ + $DIR/slowParser.c \ + $DIR/slowParser.h \ + && fail 'Camelcase files not properly deleted' + return 0 +} + +testmcp() { + DIR=test-mcp + mkdir -p $DIR + touch \ + $DIR/bytecodeVm.c \ + $DIR/fastLexer.c \ + $DIR/fastLexer.h \ + $DIR/slowParser.c \ + $DIR/slowParser.h + ls $DIR/*.[ch] | mcp sed 's/[A-Z]/\L-&/g' + >/dev/null ls \ + $DIR/bytecode-vm.c \ + $DIR/fast-lexer.c \ + $DIR/fast-lexer.h \ + $DIR/slow-parser.c \ + $DIR/slow-parser.h \ + || fail 'Missing lispcase files' + >/dev/null ls \ + $DIR/bytecodeVm.c \ + $DIR/fastLexer.c \ + $DIR/fastLexer.h \ + $DIR/slowParser.c \ + $DIR/slowParser.h \ + || fail 'Camelcase files not found' + return 0 +} + +testmmvbasename() { + DIR=test-mmv-basename + mkdir -p $DIR + touch \ + $DIR/bytecode-vm.c \ + $DIR/fast-lexer.c \ + $DIR/fast-lexer.h \ + $DIR/slow-parser.c \ + $DIR/slow-parser.h + ls $DIR/*.[ch] | mmv --basename tr a-z A-Z + >/dev/null ls \ + $DIR/BYTECODE-VM.C \ + $DIR/FAST-LEXER.C \ + $DIR/FAST-LEXER.H \ + $DIR/SLOW-PARSER.C \ + $DIR/SLOW-PARSER.H \ + || fail 'Uppercase files not found' + 2>/dev/null ls \ + $DIR/bytecode-vm.c \ + $DIR/fast-lexer.c \ + $DIR/fast-lexer.h \ + $DIR/slow-parser.c \ + $DIR/slow-parser.h \ + && fail 'Lowercase files found' + return 0 +} + +trap 'rm -rf test-mmv test-mcp test-mmv-basename' EXIT +testmmv +testmcp +testmmvbasename |