Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
laniakea64 committed Jan 13, 2024
1 parent b9e0b22 commit 222f821
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 2 deletions.
7 changes: 7 additions & 0 deletions tests/cases/directories.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xdg_cache <span class="Operator">:=</span> <span class="Function">cache_directory</span>()
xdg_config <span class="Operator">:=</span> <span class="Function">config_directory</span>()
xdg_config_local <span class="Operator">:=</span> <span class="Function">config_local_directory</span>()
xdg_data <span class="Operator">:=</span> <span class="Function">data_directory</span>()
xdg_data_local <span class="Operator">:=</span> <span class="Function">data_local_directory</span>()
xdg_executable <span class="Operator">:=</span> <span class="Function">executable_directory</span>()
xdg_home <span class="Operator">:=</span> <span class="Function">home_directory</span>()
7 changes: 7 additions & 0 deletions tests/cases/directories.just
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xdg_cache := cache_directory()
xdg_config := config_directory()
xdg_config_local := config_local_directory()
xdg_data := data_directory()
xdg_data_local := data_local_directory()
xdg_executable := executable_directory()
xdg_home := home_directory()
4 changes: 4 additions & 0 deletions tests/cases/recipes-with-extras.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@

<span class="Function">interp_with_conditional</span> <span class="Identifier">foo</span><span class="Operator">:</span>
<span class="Number"> echo </span><span class="Delimiter">{{</span><span class="Conditional">if</span><span class="Normal"> </span><span class="Identifier">foo</span><span class="Normal"> </span><span class="Operator">!=</span><span class="Normal"> </span><span class="String">'foo'</span><span class="Normal"> { </span><span class="Function">quote</span><span class="Normal">(</span><span class="Identifier">foo</span><span class="Normal">) } </span><span class="Conditional">else</span><span class="Normal"> { </span><span class="Identifier">foo</span><span class="Normal"> </span><span class="Operator">/</span><span class="Normal"> </span><span class="Identifier">foo</span><span class="Normal"> } </span><span class="Delimiter">}}</span>

<span class="Type">[no-quiet]</span>
<span class="Function">loud</span><span class="Operator">:</span>
<span class="Number"> echo LOUD</span>
4 changes: 4 additions & 0 deletions tests/cases/recipes-with-extras.just
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,7 @@ interp_with_func_with_arg foo:

interp_with_conditional foo:
echo {{if foo != 'foo' { quote(foo) } else { foo / foo } }}

[no-quiet]
loud:
echo LOUD
4 changes: 4 additions & 0 deletions tests/cases/set.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<span class="Statement">set</span> <span class="Keyword">positional-arguments</span> <span class="Operator">:=</span> <span class="Boolean">true</span>
<span class="Statement">set</span> <span class="Keyword">positional-arguments</span> <span class="Operator">:=</span> <span class="Boolean">false</span>

<span class="Statement">set</span> <span class="Keyword">quiet</span>
<span class="Statement">set</span> <span class="Keyword">quiet</span> <span class="Operator">:=</span> <span class="Boolean">true</span>
<span class="Statement">set</span> <span class="Keyword">quiet</span> <span class="Operator">:=</span> <span class="Boolean">false</span>

<span class="Statement">set</span> <span class="Keyword">shell</span> <span class="Operator">:=</span> [<span class="String">"foo"</span>]
<span class="Statement">set</span> <span class="Keyword">shell</span> <span class="Operator">:=</span> [<span class="String">"foo"</span>,]
<span class="Statement">set</span> <span class="Keyword">shell</span> <span class="Operator">:=</span> [<span class="String">"foo"</span>, <span class="String">"bar"</span>]
Expand Down
4 changes: 4 additions & 0 deletions tests/cases/set.just
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ set positional-arguments
set positional-arguments := true
set positional-arguments := false

set quiet
set quiet := true
set quiet := false

set shell := ["foo"]
set shell := ["foo",]
set shell := ["foo", "bar"]
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/tricky.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
<span class="Function">multi</span> <span class="Identifier">count</span><span class="Operator">=</span><span class="Function">num_cpus</span>()<span class="Operator">:</span>
<span class="Number"> seq -s </span><span class="String">' '</span><span class="Number"> 1 </span><span class="Delimiter">{{</span><span class="Identifier">count</span><span class="Delimiter">}}</span>

<span class="Function">functions2</span> <span class="Identifier">cpus</span> <span class="Operator">=</span> <span class="Function">num_cpus</span>() <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Function">env</span>(<span class="String">'FOO'</span>, <span class="Function">uuid</span>()) <span class="Operator">:</span>
<span class="Function">functions2</span> <span class="Identifier">cpus</span> <span class="Operator">=</span> <span class="Function">num_cpus</span>() <span class="Identifier">foo</span> <span class="Operator">=</span> <span class="Function">env</span>(<span class="String">'FOO'</span>, <span class="Function">just_pid</span>()) <span class="Operator">:</span>
<span class="Number"> echo </span><span class="String">'</span><span class="Delimiter">{{</span><span class="Identifier">foo</span><span class="Delimiter">}}</span><span class="String">:x</span><span class="Delimiter">{{</span><span class="Identifier">cpus</span><span class="Delimiter">}}</span><span class="String">'</span>

<span class="Function">env_test_export</span><span class="Operator">:</span>
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/tricky.just
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ invoke shell:
multi count=num_cpus():
seq -s ' ' 1 {{count}}
functions2 cpus = num_cpus() foo = env('FOO', uuid()) :
functions2 cpus = num_cpus() foo = env('FOO', just_pid()) :
echo '{{foo}}:x{{cpus}}'
env_test_export:
Expand Down

0 comments on commit 222f821

Please sign in to comment.