Class: RubyLsp::Requests::Support::TestItem
- Inherits:
-
Object
- Object
- RubyLsp::Requests::Support::TestItem
- Defined in:
- lib/ruby_lsp/requests/support/test_item.rb
Overview
Represents a test item as defined by the VS Code interface to be used in the test explorer See code.visualstudio.com/api/references/vscode-api#TestItem
Note: this test item object can only represent test groups or examples discovered inside files. It cannot be used to represent test files, directories or workspaces
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
: String.
-
#label ⇒ Object
readonly
: String.
-
#range ⇒ Object
readonly
: Interface::Range.
-
#uri ⇒ Object
readonly
: URI::Generic.
Instance Method Summary collapse
-
#[](id) ⇒ Object
: (String id) -> TestItem?.
-
#add(item) ⇒ Object
: (TestItem item) -> void.
-
#children ⇒ Object
: -> Array.
-
#initialize(id, label, uri, range, framework:) ⇒ TestItem
constructor
: (String id, String label, URI::Generic uri, Interface::Range range, framework: Symbol) -> void.
-
#to_hash ⇒ Object
: -> Hash[Symbol, untyped].
Constructor Details
#initialize(id, label, uri, range, framework:) ⇒ TestItem
: (String id, String label, URI::Generic uri, Interface::Range range, framework: Symbol) -> void
23 24 25 26 27 28 29 30 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 23 def initialize(id, label, uri, range, framework:) @id = id @label = label @uri = uri @range = range @tags = ["framework:#{framework}"] #: Array[String] @children = {} #: Hash[String, TestItem] end |
Instance Attribute Details
#id ⇒ Object (readonly)
: String
14 15 16 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 14 def id @id end |
#label ⇒ Object (readonly)
: String
14 15 16 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 14 def label @label end |
#range ⇒ Object (readonly)
: Interface::Range
20 21 22 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 20 def range @range end |
#uri ⇒ Object (readonly)
: URI::Generic
17 18 19 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 17 def uri @uri end |
Instance Method Details
#[](id) ⇒ Object
: (String id) -> TestItem?
38 39 40 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 38 def [](id) @children[id] end |
#add(item) ⇒ Object
: (TestItem item) -> void
33 34 35 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 33 def add(item) @children[item.id] = item end |
#children ⇒ Object
: -> Array
43 44 45 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 43 def children @children.values end |
#to_hash ⇒ Object
: -> Hash[Symbol, untyped]
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/ruby_lsp/requests/support/test_item.rb', line 48 def to_hash { id: @id, label: @label, uri: @uri, range: @range, tags: @tags, children: children.map(&:to_hash), } end |