Sha256: 253c3c99e949c478ff9b5c3b31fc9cc51ba28d8fc275f1d01310e5f121fbaad6

Contents?: true

Size: 758 Bytes

Versions: 44

Compression:

Stored size: 758 Bytes

Contents

#! /usr/bin/env ruby
require 'spec_helper'

describe "the scanf function" do
  let(:node) { Puppet::Node.new('localhost') }
  let(:compiler) { Puppet::Parser::Compiler.new(node) }
  let(:scope) { Puppet::Parser::Scope.new(compiler) }

  it 'scans a value and returns an array' do
    expect(scope.function_scanf(['42', '%i'])[0] == 42)
  end

  it 'returns empty array if nothing was scanned' do
    expect(scope.function_scanf(['no', '%i']) == [])
  end

  it 'produces result up to first unsuccessful scan' do
    expect(scope.function_scanf(['42 no', '%i'])[0] == 42)
  end

  it 'errors when not given enough arguments' do
    expect do
      scope.function_scanf(['42'])
    end.to raise_error(/.*scanf\(\): Wrong number of arguments given/m)
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
puppet-6.4.0 spec/unit/parser/functions/scanf_spec.rb
puppet-6.4.0-x86-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.4.0-x64-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.4.0-universal-darwin spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.7 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.7-x86-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.7-x64-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.7-universal-darwin spec/unit/parser/functions/scanf_spec.rb
puppet-6.3.0 spec/unit/parser/functions/scanf_spec.rb
puppet-6.3.0-x86-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.3.0-x64-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.3.0-universal-darwin spec/unit/parser/functions/scanf_spec.rb
puppet-6.2.0 spec/unit/parser/functions/scanf_spec.rb
puppet-6.2.0-x86-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.2.0-x64-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.2.0-universal-darwin spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.5 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.5-x86-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.5-x64-mingw32 spec/unit/parser/functions/scanf_spec.rb
puppet-6.0.5-universal-darwin spec/unit/parser/functions/scanf_spec.rb