Skip to content

Commit

Permalink
Diminish the notion of prelude #84
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Dec 8, 2021
1 parent 2ba018e commit ebe5744
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 81 deletions.
1 change: 0 additions & 1 deletion tests/10_define.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

@define A=aaa
@define B=${A}bbb
C=ccc

@goal testA
echo A=$A
Expand Down
3 changes: 3 additions & 0 deletions tests/12_errors.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@

echo 'code in prelude'
echo 'more code in prelude'

@reached_if true
@depends_on g1
@doc Doc in prelude
Expand Down
46 changes: 24 additions & 22 deletions tests/12_errors.tush
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@

$ cd "$MYDIR"; ./$MAKESURE -f tests/12_errors.sh
@ Shell code is not allowed in prelude area:
@ tests/12_errors.sh:2: echo 'code in prelude'
@ Only use @reached_if in @goal:
@ tests/12_errors.sh:2: @reached_if true
@ tests/12_errors.sh:5: @reached_if true
@ Only use @depends_on in @goal:
@ tests/12_errors.sh:3: @depends_on g1
@ tests/12_errors.sh:6: @depends_on g1
@ Only use @doc in @goal:
@ tests/12_errors.sh:4: @doc Doc in prelude
@ tests/12_errors.sh:7: @doc Doc in prelude
@ Option 'unsupported' is not supported:
@ tests/12_errors.sh:5: @options unsupported
@ tests/12_errors.sh:8: @options unsupported
@ Provide at least one option:
@ tests/12_errors.sh:6: @options
@ tests/12_errors.sh:9: @options
@ Shell 'unsupported' is not supported:
@ tests/12_errors.sh:7: @shell unsupported
@ tests/12_errors.sh:10: @shell unsupported
@ Shell '' is not supported:
@ tests/12_errors.sh:8: @shell
@ tests/12_errors.sh:11: @shell
@ Only use @use_lib in @goal:
@ tests/12_errors.sh:9: @use_lib lib1
@ tests/12_errors.sh:12: @use_lib lib1
@ Goal must have a name:
@ tests/12_errors.sh:11: @goal
@ tests/12_errors.sh:14: @goal
@ Goal 'g1' is already defined:
@ tests/12_errors.sh:17: @goal g1
@ tests/12_errors.sh:20: @goal g1
@ Provide at least one dependency:
@ tests/12_errors.sh:18: @depends_on
@ tests/12_errors.sh:21: @depends_on
@ Multiple @reached_if not allowed for a goal:
@ tests/12_errors.sh:20: @reached_if false
@ tests/12_errors.sh:23: @reached_if false
@ Only use @shell in prelude:
@ tests/12_errors.sh:25: @shell sh
@ tests/12_errors.sh:28: @shell sh
@ Only use @define in prelude:
@ tests/12_errors.sh:26: @define A=1
@ tests/12_errors.sh:29: @define A=1
@ Multiple @doc not allowed for a goal:
@ tests/12_errors.sh:31: @doc doc2
@ tests/12_errors.sh:34: @doc doc2
@ Only use @options in prelude:
@ tests/12_errors.sh:32: @options timing
@ tests/12_errors.sh:35: @options timing
@ Unknown directive: @unknown_directive:
@ tests/12_errors.sh:33: @unknown_directive arg
@ tests/12_errors.sh:36: @unknown_directive arg
@ You can only use one @lib in a @goal:
@ tests/12_errors.sh:35: @use_lib lib2
@ tests/12_errors.sh:38: @use_lib lib2
@ Goal 'g1' has unknown dependency 'unknown':
@ tests/12_errors.sh:15: @depends_on unknown
@ tests/12_errors.sh:18: @depends_on unknown
@ Goal 'g2' uses unknown lib 'unknown':
@ tests/12_errors.sh:24: @use_lib unknown
@ tests/12_errors.sh:27: @use_lib unknown
@ Goal 'g13' uses unknown lib 'unknown1':
@ tests/12_errors.sh:38: @use_lib unknown1
@ tests/12_errors.sh:41: @use_lib unknown1
@ Goal 'g14' has unknown dependency 'unknown1':
@ tests/12_errors.sh:41: @depends_on unknown1
@ tests/12_errors.sh:44: @depends_on unknown1
? 1
File renamed without changes.
10 changes: 0 additions & 10 deletions tests/18_vars_priority.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@

echo "in prelude: A=$A"
echo "in prelude: V=$V"
sh -c 'echo "in prelude: in child: A=$A"'
sh -c 'echo "in prelude: in child: V=$V"'

@define V="V_prelude"

echo "in prelude: A=$A"
echo "in prelude: V=$V"
sh -c 'echo "in prelude: in child: A=$A"'
sh -c 'echo "in prelude: in child: V=$V"'

@goal default
echo "A=$A"
echo "V=$V"
Expand Down
40 changes: 0 additions & 40 deletions tests/18_vars_priority.tush
Original file line number Diff line number Diff line change
@@ -1,73 +1,33 @@

$ cd "$MYDIR"; ./$MAKESURE -f tests/18_vars_priority.sh
| in prelude: A=
| in prelude: V=
| in prelude: in child: A=
| in prelude: in child: V=
| in prelude: A=
| in prelude: V=V_prelude
| in prelude: in child: A=
| in prelude: in child: V=V_prelude
| goal 'default' ...
| A=
| V=V_prelude
| in child: A=
| in child: V=V_prelude

$ cd "$MYDIR"; A=A_env ./$MAKESURE -f tests/18_vars_priority.sh
| in prelude: A=A_env
| in prelude: V=
| in prelude: in child: A=A_env
| in prelude: in child: V=
| in prelude: A=A_env
| in prelude: V=V_prelude
| in prelude: in child: A=A_env
| in prelude: in child: V=V_prelude
| goal 'default' ...
| A=A_env
| V=V_prelude
| in child: A=A_env
| in child: V=V_prelude

$ cd "$MYDIR"; V=V_env ./$MAKESURE -f tests/18_vars_priority.sh
| in prelude: A=
| in prelude: V=V_env
| in prelude: in child: A=
| in prelude: in child: V=V_env
| in prelude: A=
| in prelude: V=V_prelude
| in prelude: in child: A=
| in prelude: in child: V=V_prelude
| goal 'default' ...
| A=
| V=V_prelude
| in child: A=
| in child: V=V_prelude

$ cd "$MYDIR"; ./$MAKESURE -f tests/18_vars_priority.sh -D V=V_D
| in prelude: A=
| in prelude: V=V_D
| in prelude: in child: A=
| in prelude: in child: V=V_D
| in prelude: A=
| in prelude: V=V_D
| in prelude: in child: A=
| in prelude: in child: V=V_D
| goal 'default' ...
| A=
| V=V_D
| in child: A=
| in child: V=V_D

$ cd "$MYDIR"; V=V_env ./$MAKESURE -f tests/18_vars_priority.sh -D V=V_D
| in prelude: A=
| in prelude: V=V_D
| in prelude: in child: A=
| in prelude: in child: V=V_D
| in prelude: A=
| in prelude: V=V_D
| in prelude: in child: A=
| in prelude: in child: V=V_D
| goal 'default' ...
| A=
| V=V_D
Expand Down
3 changes: 0 additions & 3 deletions tests/7_options.tush
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ $ cd "$MYDIR"; ./$MAKESURE -f tests/7_options_in_goal.sh
? 1

$ cd "$MYDIR"; ./$MAKESURE -f tests/7_options_tracing.sh -x
| prelude 123
| goal 'default' ...
| test
@ + A=123
@ + echo 'prelude 123'
@ + echo test

3 changes: 0 additions & 3 deletions tests/7_options_tracing.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@

@options tracing

A=123
echo "prelude $A"

@goal default
echo test
6 changes: 5 additions & 1 deletion tests/9_prelude.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@

echo "prelude should execute only once"
# no code allowed in prelude,
# only comments, @define, @shell, @options

@shell bash
@define A=B

@goal a
@depends_on b
Expand Down
1 change: 0 additions & 1 deletion tests/9_prelude.tush
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

$ cd "$MYDIR"; ./$MAKESURE -f tests/9_prelude.sh a
| prelude should execute only once
| goal 'c' [already satisfied].
| goal 'd' ...
| d
Expand Down

0 comments on commit ebe5744

Please sign in to comment.