Skip to content

Commit

Permalink
Remove redundant strings
Browse files Browse the repository at this point in the history
  • Loading branch information
minhqdao committed Mar 10, 2024
1 parent e0a4930 commit 63332ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
17 changes: 5 additions & 12 deletions src/version_f.f90
Original file line number Diff line number Diff line change
Expand Up @@ -325,39 +325,32 @@ elemental function create_error_t(msg) result(err)
err%msg = msg
end

subroutine try_satisfy(string)
character(*), intent(in) :: string
subroutine try_satisfy()
type(version_range_t) :: version_range

call version_range%parse_version_range(string)
call version_range%parse_version_range()

if (version_range%comp_sets(1)%comps(1)%op /= '>') then
print *, 'Operator not >: ', version_range%comp_sets(1)%comps(1)%op; stop 1
end if
end

subroutine parse_version_range(this, string)
subroutine parse_version_range(this)
class(version_range_t), intent(out) :: this
character(*), intent(in) :: string

type(comparator_set_t) :: comp_set

allocate (this%comp_sets(0))

call comp_set%parse_comp_set(string)
call comp_set%parse_comp_set()

this%comp_sets = [this%comp_sets, comp_set]
end

subroutine parse_comp_set(this, string)
subroutine parse_comp_set(this)
class(comparator_set_t), intent(out) :: this
character(*), intent(in) :: string

character(:), allocatable :: str
type(comparator_t) :: comp
type(error_t), allocatable :: error

str = trim(adjustl(string))

allocate (this%comps(0))

Expand Down
2 changes: 1 addition & 1 deletion test/version_f_test.f90
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ program test
use version_f
implicit none

call try_satisfy('> 1.0.1 < 2.1.0')
call try_satisfy()

print *, achar(10)//achar(27)//'[92m All tests passed.'//achar(27)

Expand Down

0 comments on commit 63332ce

Please sign in to comment.