Skip to content

Commit

Permalink
Merge pull request #40 from sorbits/master
Browse files Browse the repository at this point in the history
Make “Go → Test” run tests for current file and other minor changes
  • Loading branch information
AlanQuatermain committed Jul 8, 2013
2 parents 8db2d87 + 77f97eb commit 23ff67f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Commands/Compile.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Go::go "build", :verb => "Compiling"
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>@k</string>
<string>@b</string>
<key>name</key>
<string>Compile</string>
<key>outputCaret</key>
Expand Down
4 changes: 2 additions & 2 deletions Commands/Test.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Go::go "test", :verb =&gt; "Testing"
<key>inputFormat</key>
<string>text</string>
<key>keyEquivalent</key>
<string>~@t</string>
<string>@R</string>
<key>name</key>
<string>Test</string>
<string>Run Tests</string>
<key>outputCaret</key>
<string>afterOutput</string>
<key>outputFormat</key>
Expand Down
19 changes: 12 additions & 7 deletions Support/gomate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@ def Go::go(command, options={})
TextMate::Executor.make_project_master_current_document

args = options[:args] ? options[:args] : []
opts = {:interactive_input => false, :use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/}
opts = {:use_hashbang => false, :version_args => ['version'], :version_regex => /\Ago version (.*)/}
opts[:verb] = options[:verb] if options[:verb]

# At this time, we will always run 'go' against a single file. In the future there may be new
# commands that will invalidate this but until then, might as well start simple.
args.push(ENV['TM_FILEPATH'])
if command == 'test' && ENV['TM_FILENAME'] =~ /(_test)?(\.go)$/
basename = $`
args.push("#{basename}.go")
args.push("#{basename}_test.go")
opts[:chdir] = ENV['TM_DIRECTORY']
else
# At this time, we will always run 'go' against a single file. In the future there may be new
# commands that will invalidate this but until then, might as well start simple.
args.push(ENV['TM_FILEPATH'])
end
args.push(opts)

TextMate::Executor.run(go_cmd, command, *args) do |str, type|
Go::link_errs(str, type)
end
TextMate::Executor.run(go_cmd, command, *args)
end

def Go::godoc
Expand Down
3 changes: 1 addition & 2 deletions info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@
<key>items</key>
<array>
<string>0B3C3EB0-9F51-4997-A87D-ECA507D8E31E</string>
<string>73628139-0077-4F09-9B72-77546D7C2D2D</string>
<string>0F6A8710-54FC-48F5-9D02-D093DA001D17</string>
<string>20810F68-79E2-4D36-B222-6374BDEAB7B9</string>
<string>73628139-0077-4F09-9B72-77546D7C2D2D</string>
<string>------------------------------------</string>
<string>7BCFCFC8-9152-4638-8436-E17B0C754C8D</string>
<string>B0271A46-F6EF-4D2F-95A6-EC067E69155C</string>
Expand Down

0 comments on commit 23ff67f

Please sign in to comment.