Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/spec/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2017-04-12 21:11:35 +0300
committerLin Jen-Shin <godfat@godfat.org>2017-04-13 16:44:26 +0300
commitfaa5dffbcc0a2649ee8f427905d45d7061975bcb (patch)
tree2ab9fe2bda4263befc45e03b15391933e17d6912 /spec/lib
parent7629c9ec57cb9b14f41c1163b61df1e6ea6b0ca1 (diff)
After Trace#limit, we seek to the next line in case
of breaking ANSI sequence or Unicode
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/ci/trace/stream_spec.rb22
1 files changed, 21 insertions, 1 deletions
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb
index 2e57ccef182..61ac76401ea 100644
--- a/spec/lib/gitlab/ci/trace/stream_spec.rb
+++ b/spec/lib/gitlab/ci/trace/stream_spec.rb
@@ -21,7 +21,7 @@ describe Gitlab::Ci::Trace::Stream do
end
end
- it 'if size is larger we start from beggining' do
+ it 'if size is larger we start from beginning' do
stream.limit(10)
expect(stream.tell).to eq(0)
@@ -32,6 +32,26 @@ describe Gitlab::Ci::Trace::Stream do
expect(stream.tell).to eq(6)
end
+
+ context 'when the trace contains ANSI sequence and Unicode' do
+ let(:stream) do
+ described_class.new do
+ File.open(expand_fixture_path('trace/ansi-sequence-and-unicode'))
+ end
+ end
+
+ it 'forwards to the next linefeed, case 1' do
+ stream.limit(7)
+
+ expect(stream.raw).to eq('')
+ end
+
+ it 'forwards to the next linefeed, case 2' do
+ stream.limit(29)
+
+ expect(stream.raw).to eq("\e[01;32m許功蓋\e[0m\n")
+ end
+ end
end
describe '#append' do