Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion functions/_tide_item_java.fish
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function _tide_item_java
if path is $_tide_parent_dirs/pom.xml
if path is $_tide_parent_dirs/pom.xml $_tide_parent_dirs/build.gradle
java -version &| string match -qr "(?<v>[\d.]+)"
_tide_print_item java $tide_java_icon' ' $v
end
Expand Down
20 changes: 20 additions & 0 deletions tests/_tide_item_java.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,26 @@ _java # CHECK:

touch pom.xml

mock java -version "echo 'openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12)
OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)'"

_java # CHECK:  17.0.1

mock java -version "echo 'openjdk version \"1.8.0_332\"
OpenJDK Runtime Environment (build 1.8.0_332-b04)
OpenJDK 64-Bit Server VM (build 25.332-b04, mixed mode)' >&2"

_java # CHECK:  1.8.0

command rm pom.xml

touch build.gradle

mock java -version "echo 'openjdk 17.0.1 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12)
OpenJDK 64-Bit Server VM (build 17.0.1+12, mixed mode)'"

_java # CHECK:  17.0.1

mock java -version "echo 'openjdk version \"1.8.0_332\"
Expand Down