Skip to content

Commit

Permalink
chore: type name refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
s1n7ax committed Jul 19, 2024
1 parent a3fe70c commit c341458
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 29 deletions.
14 changes: 7 additions & 7 deletions lua/java-test/reports/junit.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
local class = require('java-core.utils.class')
local log = require('java-core.utils.log')

---@class java_test.JUnitTestReport
---@class java-test.JUnitTestReport
---@field private conn uv_tcp_t
---@field private result_parser java_test.TestParser
---@field private result_parser_fac java_test.TestParserFactory
---@field private report_viewer java_test.ReportViewer
---@overload fun(result_parser_factory: java_test.TestParserFactory, test_viewer: java_test.ReportViewer)
---@field private result_parser java-test.TestParser
---@field private result_parser_fac java-test.TestParserFactory
---@field private report_viewer java-test.ReportViewer
---@overload fun(result_parser_factory: java-test.TestParserFactory, test_viewer: java-test.ReportViewer)
local JUnitReport = class()

---Init
---@param result_parser_factory java_test.TestParserFactory
---@param result_parser_factory java-test.TestParserFactory
function JUnitReport:_init(result_parser_factory, report_viewer)
self.conn = nil
self.result_parser_fac = result_parser_factory
self.report_viewer = report_viewer
end

---Returns the test results
---@return java_test.TestResults[]
---@return java-test.TestResults[]
function JUnitReport:get_results()
return self.result_parser:get_test_details()
end
Expand Down
2 changes: 1 addition & 1 deletion lua/java-test/results/execution-status.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---@enum java_test.TestExecutionStatus
---@enum java-test.TestExecutionStatus
local TestStatus = {
Started = 'started',
Ended = 'ended',
Expand Down
7 changes: 3 additions & 4 deletions lua/java-test/results/result-parser-factory.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
local class = require('java-core.utils.class')
local TestParser = require('java-test.results.result-parser')

---@class java_test.TestParserFactory
---@class java-test.TestParserFactory
local TestParserFactory = class()

---Returns a test parser of given type
---@param args any
---@return java_test.TestParser
function TestParserFactory.get_parser(_args)
---@return java-test.TestParser
function TestParserFactory.get_parser()
return TestParser()
end

Expand Down
18 changes: 9 additions & 9 deletions lua/java-test/results/result-parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ local MessageId = require('java-test.results.message-id')
local TestStatus = require('java-test.results.result-status')
local TestExecStatus = require('java-test.results.execution-status')

---@class java_test.TestParser
---@field private test_details java_test.TestResults[]
---@class java-test.TestParser
---@field private test_details java-test.TestResults[]
local TestParser = class()

---Init
Expand Down Expand Up @@ -58,7 +58,7 @@ function TestParser:parse(text)
end

---Returns the parsed test details
---@return java_test.TestResults # parsed test details
---@return java-test.TestResults # parsed test details
function TestParser:get_test_details()
return self.test_details
end
Expand Down Expand Up @@ -179,14 +179,14 @@ end

return TestParser

---@class java_test.TestResultExecutionDetails
---@class java-test.TestResultExecutionDetails
---@field actual string[] lines
---@field expected string[] lines
---@field status java_test.TestStatus
---@field execution java_test.TestExecutionStatus
---@field status java-test.TestStatus
---@field execution java-test.TestExecutionStatus
---@field trace string[] lines

---@class java_test.TestResults
---@class java-test.TestResults
---@field display_name string
---@field is_dynamic_test boolean
---@field is_suite boolean
Expand All @@ -196,5 +196,5 @@ return TestParser
---@field test_id integer
---@field test_name string
---@field unique_id string
---@field result java_test.TestResultExecutionDetails
---@field children java_test.TestResults[]
---@field result java-test.TestResultExecutionDetails
---@field children java-test.TestResults[]
2 changes: 1 addition & 1 deletion lua/java-test/results/result-status.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---@enum java_test.TestStatus
---@enum java-test.TestStatus
local TestStatus = {
Failed = 'failed',
Skipped = 'skipped',
Expand Down
10 changes: 5 additions & 5 deletions lua/java-test/ui/floating-report-viewer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ local StringBuilder = require('java-test.utils.string-builder')
local TestStatus = require('java-test.results.result-status')
local ReportViewer = require('java-test.ui.report-viewer')

---@class java_test.FloatingReportViewer
---@class java-test.FloatingReportViewer
---@field window number|nil
---@field buffer number|nil
---@overload fun(): java_test.FloatingReportViewer
---@overload fun(): java-test.FloatingReportViewer
local FloatingReportViewer = class(ReportViewer)

---Shows the test results in a floating window
---@param test_results java_test.TestResults[]
function FloatingReportViewer:show(test_results)
---@param results java_test.TestResults[]
---@param test_results java-test.TestResults[]
function FloatingReportViewer.show(test_results)
---@param results java-test.TestResults[]
local function build_result(results, indentation, prefix)
local ts = StringBuilder()

Expand Down
4 changes: 2 additions & 2 deletions lua/java-test/ui/report-viewer.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
local class = require('java-core.utils.class')

---@class java_test.ReportViewer
---@class java-test.ReportViewer
local ReportViewer = class()

---Shows the test results in a floating window
---@param _ java_test.TestResults[]
---@param _ java-test.TestResults[]
function ReportViewer:show(_)
error('not implemented')
end
Expand Down

0 comments on commit c341458

Please sign in to comment.