File: new_test

package info (click to toggle)
mkvtoolnix 97.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 60,284 kB
  • sloc: cpp: 217,034; ruby: 11,453; xml: 8,125; ansic: 6,885; sh: 5,274; python: 1,041; perl: 191; makefile: 113; awk: 16; javascript: 4
file content (37 lines) | stat: -rwxr-xr-x 508 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/zsh

if [ "$1" = "" ]; then
  echo 'Name?'
  exit 1
fi

name="${${1%.rb}//-/_}"
max_num=(test*(.On[1]))
let next_num=${max_num[1][6,9]}+1

new_file="test-$(printf '%04d' ${next_num})${name}.rb"

cat > "$new_file" <<EOF
#!/usr/bin/ruby -w

# T_${next_num}${name}
describe "FIXTHIS"

setup do
  # FIXTHIS
end

cleanup do
  # FIXTHIS
end

test_merge "data/FIXTHIS"
test_merge "data/FIXTHIS", :args => "FIXTHIS"

test "data/FIXTHIS" do
  # INSERT COMMANDS
  hash_tmp
end
EOF

echo "New file is $new_file"