mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-13 11:04:27 -05:00
28 lines
806 B
Ruby
28 lines
806 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'spec_helper'
|
|
|
|
RSpec.describe KernAux, '.sprintf1' do
|
|
if described_class.singleton_class.method_defined? :sprintf1
|
|
context 'with 1 argument' do
|
|
subject(:sprintf1) { described_class.sprintf1 format }
|
|
|
|
let(:format) { '%%' }
|
|
|
|
it { is_expected.to be_instance_of String }
|
|
it { is_expected.to be_frozen }
|
|
it { is_expected.to eq described_class.snprintf1(1000, format).first }
|
|
end
|
|
|
|
context 'with 2 argument' do
|
|
subject(:sprintf1) { described_class.sprintf1 format, arg }
|
|
|
|
let(:format) { '%s' }
|
|
let(:arg) { 'Hello, World!' }
|
|
|
|
it { is_expected.to be_instance_of String }
|
|
it { is_expected.to be_frozen }
|
|
it { is_expected.to eq described_class.snprintf1(100, format, arg).first }
|
|
end
|
|
end
|
|
end
|