Skip to content

Commit

Permalink
Add forth ctags unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
techee committed Nov 24, 2024
1 parent 7f9bed0 commit c7d5a26
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/ctags/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ test_sources = \
simple.d \
simple.diff \
simple.docbook \
simple.fth \
simple.hs \
simple.hx \
simple.html \
Expand Down
31 changes: 31 additions & 0 deletions tests/ctags/simple.fth
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

( https://rosettacode.org/wiki/FizzBuzz#Forth / https://skilldrick.github.io/easyforth/ )

\ Works in gforth and other ANS forth. Other Forth may differ.

10 constant DUMMY1
12 CONSTANT DUMMY2

variable dummy3
variable dummy4
VARIABLE dummy5

11 dummy3 !
13 dummy4 !

: fizz? \ a simple comment
3 mod 0 = dup if ." Fizz" then ;
: buzz?
5 mod 0 = dup if ." Buzz" then ;

: fizz-buzz?
dup fizz? swap buzz? or invert ;

: do-fizz-buzz
25 1 do cr i fizz-buzz? if i . then loop ;

do-fizz-buzz
cr

quit
\ bye
18 changes: 18 additions & 0 deletions tests/ctags/simple.fth.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
DUMMY1�65536�0
macro: DUMMY1
DUMMY2�65536�0
macro: DUMMY2
buzz?�16�0
function: buzz?
do-fizz-buzz�16�0
function: do-fizz-buzz
dummy3�16384�0
variable: dummy3
dummy4�16384�0
variable: dummy4
dummy5�16384�0
variable: dummy5
fizz-buzz?�16�0
function: fizz-buzz?
fizz?�16�0
function: fizz?
1 change: 1 addition & 0 deletions tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ ctags_tests = [
'ctags/simple.d.tags',
'ctags/simple.diff.tags',
'ctags/simple.docbook.tags',
'ctags/simple.fth.tags',
'ctags/simple.hs.tags',
'ctags/simple.hx.tags',
'ctags/simple.html.tags',
Expand Down

0 comments on commit c7d5a26

Please sign in to comment.