Sha256: 7e7920c501f9b5ceb87131c5a072ae5b72bb27a909bb84c3ba9cfce909839c98

Contents?: true

Size: 1.09 KB

Versions: 15

Compression:

Stored size: 1.09 KB

Contents

# typed: true
# frozen_string_literal: true

require_relative "test_case"

module RubyIndexer
  class GlobalVariableTest < TestCase
    def test_global_variable_and_write
      index(<<~RUBY)
        $foo &&= 1
      RUBY

      assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4")
    end

    def test_global_variable_operator_write
      index(<<~RUBY)
        $foo += 1
      RUBY

      assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4")
    end

    def test_global_variable_or_write
      index(<<~RUBY)
        $foo ||= 1
      RUBY

      assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4")
    end

    def test_global_variable_target_node
      index(<<~RUBY)
        $foo, $bar = 1
      RUBY

      assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4")
      assert_entry("$bar", Entry::GlobalVariable, "/fake/path/foo.rb:0-6:0-10")
    end

    def test_global_variable_write
      index(<<~RUBY)
        $foo = 1
      RUBY

      assert_entry("$foo", Entry::GlobalVariable, "/fake/path/foo.rb:0-0:0-4")
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ruby-lsp-0.23.6 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.5 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.4 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.3 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.2 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.1 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.23.0 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.22.1 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.22.0 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.21.3 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.21.2 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.21.1 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.21.0 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.20.1 lib/ruby_indexer/test/global_variable_test.rb
ruby-lsp-0.20.0 lib/ruby_indexer/test/global_variable_test.rb