Skip to content

Commit

Permalink
Rename translate_sigs file into sigs
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandre Terrasa <[email protected]>
  • Loading branch information
Morriar committed Dec 18, 2024
1 parent d2a80fc commit 762d76b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions lib/spoom/cli/srb/sigs.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# typed: true
# frozen_string_literal: true

require "spoom/sorbet/translate_sigs"
require "spoom/sorbet/sigs"

module Spoom
module Cli
Expand All @@ -22,7 +22,7 @@ def translate(*paths)
"in `#{files.size}` file#{files.size == 1 ? "" : "s"}...\n\n")

transformed_files = transform_files(files) do |_file, contents|
Spoom::Sorbet::TranslateSigs.rbi_to_rbs(contents)
Spoom::Sorbet::Sigs.rbi_to_rbs(contents)
end

say("Translated signatures in `#{transformed_files}` file#{transformed_files == 1 ? "" : "s"}.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

module Spoom
module Sorbet
class TranslateSigs
class Sigs
class << self
extend T::Sig

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@

module Spoom
module Sorbet
class TranslateSigsTest < Minitest::Test
def test_empty
class SigsTest < Minitest::Test
def test_translate_empty
contents = ""
assert_equal(contents, TranslateSigs.rbi_to_rbs(contents))
assert_equal(contents, Sigs.rbi_to_rbs(contents))
end

def test_no_sigs
def test_translate_no_sigs
contents = <<~RBI
class A
def foo; end
end
RBI

assert_equal(contents, TranslateSigs.rbi_to_rbs(contents))
assert_equal(contents, Sigs.rbi_to_rbs(contents))
end

def test_top_level_sig
def test_translate_top_level_sig
contents = <<~RBI
# typed: true
Expand All @@ -31,7 +31,7 @@ def foo(a, b)
end
RBI

assert_equal(<<~RBS, TranslateSigs.rbi_to_rbs(contents))
assert_equal(<<~RBS, Sigs.rbi_to_rbs(contents))
# typed: true
#: (Integer a, Integer b) -> Integer
Expand All @@ -41,7 +41,7 @@ def foo(a, b)
RBS
end

def test_method_sigs
def test_translate_method_sigs
contents = <<~RBI
class A
sig { params(a: Integer).void }
Expand All @@ -56,7 +56,7 @@ def a
end
RBI

assert_equal(<<~RBS, TranslateSigs.rbi_to_rbs(contents))
assert_equal(<<~RBS, Sigs.rbi_to_rbs(contents))
class A
#: (Integer a) -> void
def initialize(a)
Expand All @@ -71,7 +71,7 @@ def a
RBS
end

def test_singleton_method_sigs
def test_translate_singleton_method_sigs
contents = <<~RBI
class A
sig { returns(Integer) }
Expand All @@ -81,7 +81,7 @@ def self.foo
end
RBI

assert_equal(<<~RBS, TranslateSigs.rbi_to_rbs(contents))
assert_equal(<<~RBS, Sigs.rbi_to_rbs(contents))
class A
#: -> Integer
def self.foo
Expand All @@ -91,7 +91,7 @@ def self.foo
RBS
end

def test_attr_sigs
def test_translate_attr_sigs
contents = <<~RBI
class A
sig { returns(Integer) }
Expand All @@ -105,7 +105,7 @@ class A
end
RBI

assert_equal(<<~RBS, TranslateSigs.rbi_to_rbs(contents))
assert_equal(<<~RBS, Sigs.rbi_to_rbs(contents))
class A
#: Integer
attr_accessor :a
Expand Down

0 comments on commit 762d76b

Please sign in to comment.