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:
authorKamil Trzciński <ayufan@ayufan.eu>2017-04-13 19:58:09 +0300
committerKamil Trzciński <ayufan@ayufan.eu>2017-04-13 19:58:09 +0300
commit7761afe0910fffc576244a7e0d9e43ada7a6045d (patch)
tree256039d2f1952b42647a4d0f4c92dcccf8a88712 /spec/lib
parent992aafbc03e315b6f8fa6355ab1856934f95d758 (diff)
parent0a3c98a7e3b76f51902612ae302e821f54eadd74 (diff)
Merge branch 'fix-trace-seeking-readline' into 'master'
After Trace#limit, we seek to the next line in case Closes #30796 See merge request !10681
Diffstat (limited to 'spec/lib')
-rw-r--r--spec/lib/gitlab/ci/trace/stream_spec.rb28
1 files changed, 24 insertions, 4 deletions
diff --git a/spec/lib/gitlab/ci/trace/stream_spec.rb b/spec/lib/gitlab/ci/trace/stream_spec.rb
index 2e57ccef182..9e3bd6d662f 100644
--- a/spec/lib/gitlab/ci/trace/stream_spec.rb
+++ b/spec/lib/gitlab/ci/trace/stream_spec.rb
@@ -17,12 +17,12 @@ describe Gitlab::Ci::Trace::Stream do
describe '#limit' do
let(:stream) do
described_class.new do
- StringIO.new("12345678")
+ StringIO.new((1..8).to_a.join("\n"))
end
end
- it 'if size is larger we start from beggining' do
- stream.limit(10)
+ it 'if size is larger we start from beginning' do
+ stream.limit(20)
expect(stream.tell).to eq(0)
end
@@ -30,7 +30,27 @@ describe Gitlab::Ci::Trace::Stream do
it 'if size is smaller we start from the end' do
stream.limit(2)
- expect(stream.tell).to eq(6)
+ expect(stream.raw).to eq("8")
+ 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