|
45 | 45 | end |
46 | 46 | end |
47 | 47 |
|
| 48 | + # Old Solargraph version |
48 | 49 | context 'when Solargraph exits unsucessfully' do |
49 | 50 | before do |
50 | 51 | result.stub(:success?).and_return(false) |
51 | 52 | subject.stub(:execute).and_return(result) |
52 | 53 | end |
53 | 54 |
|
| 55 | + # New Solargraph version (see: https://github.com/castwide/solargraph/pull/1072) |
54 | 56 | context 'and it reports typechecking issues' do |
55 | 57 | let(:stdout) do |
56 | 58 | normalize_indent(<<-MSG) |
57 | | - /home/username/src/solargraph-rails/file1.rb:36 - Unresolved constant Solargraph::Parser::Legacy::NodeChainer |
58 | | - /home/username/src/solargraph-rails/file2.rb:44 - Unresolved call to [] |
59 | | - /home/username/src/solargraph-rails/file2.rb:99 - Unresolved call to [] |
| 59 | + /home/username/src/solargraph-rails/file1.rb:36: Unresolved constant Solargraph::Parser::Legacy::NodeChainer |
| 60 | + /home/username/src/solargraph-rails/file2.rb:44: Unresolved call to [] |
| 61 | + /home/username/src/solargraph-rails/file2.rb:99: Unresolved call to [] |
60 | 62 | Typecheck finished in 8.921023999806494 seconds. |
61 | 63 | 189 problems found in 14 of 16 files. |
62 | 64 | MSG |
|
77 | 79 | expect(messages.first.line).to eq 36 |
78 | 80 | end |
79 | 81 | it 'parses and returns error message content' do |
80 | | - msg = '/home/username/src/solargraph-rails/file1.rb:36 - Unresolved constant Solargraph::Parser::Legacy::NodeChainer' |
| 82 | + msg = '/home/username/src/solargraph-rails/file1.rb:36: Unresolved constant Solargraph::Parser::Legacy::NodeChainer' |
81 | 83 | expect(messages.first.content).to eq msg |
82 | 84 | end |
83 | 85 | end |
84 | 86 | end |
85 | 87 | end |
86 | 88 |
|
| 89 | + context 'with old solargraph output format' do |
| 90 | + context 'and it reports typechecking issues' do |
| 91 | + let(:stdout) do |
| 92 | + normalize_indent(<<-MSG) |
| 93 | + /home/username/src/solargraph-rails/file1.rb:36 - Unresolved constant Solargraph::Parser::Legacy::NodeChainer |
| 94 | + /home/username/src/solargraph-rails/file2.rb:44 - Unresolved call to [] |
| 95 | + /home/username/src/solargraph-rails/file2.rb:99 - Unresolved call to [] |
| 96 | + Typecheck finished in 8.921023999806494 seconds. |
| 97 | + 189 problems found in 14 of 16 files. |
| 98 | + MSG |
| 99 | + end |
| 100 | + |
| 101 | + ['', 'unexpected output'].each do |stderr_string| |
| 102 | + context "with stderr output of #{stderr_string.inspect}" do |
| 103 | + let(:stderr) { stderr_string } |
| 104 | + |
| 105 | + it { should fail_hook } |
| 106 | + it 'reports only three errors and assumes stderr is harmless' do |
| 107 | + expect(messages.size).to eq 3 |
| 108 | + end |
| 109 | + it 'parses filename' do |
| 110 | + expect(messages.first.file).to eq '/home/username/src/solargraph-rails/file1.rb' |
| 111 | + end |
| 112 | + it 'parses line number of messages' do |
| 113 | + expect(messages.first.line).to eq 36 |
| 114 | + end |
| 115 | + it 'parses and returns error message content' do |
| 116 | + msg = '/home/username/src/solargraph-rails/file1.rb:36 - Unresolved constant Solargraph::Parser::Legacy::NodeChainer' |
| 117 | + expect(messages.first.content).to eq msg |
| 118 | + end |
| 119 | + end |
| 120 | + end |
| 121 | + end |
| 122 | + end |
| 123 | + |
87 | 124 | context 'but it reports no typechecking issues' do |
88 | 125 | let(:stdout) do |
89 | 126 | normalize_indent(<<-MSG) |
|
0 commit comments