File: test_base64.rb

package info (click to toggle)
ruby-base64 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: ruby: 172; sh: 4; makefile: 4
file content (44 lines) | stat: -rw-r--r-- 1,183 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# frozen_string_literal: true

require 'base64'
require 'test/unit'
require 'rbs/unit_test'

class Base64SingletonTest < Test::Unit::TestCase
  include RBS::UnitTest::TypeAssertions

  library 'base64'
  testing "singleton(::Base64)"

  def test_decode64
    assert_send_type '(String) -> String',
                     Base64, :decode64, 'aGVsbG8gd29ybGQ='
  end

  def test_encode64
    assert_send_type '(String) -> String',
                     Base64, :encode64, 'hello world'
  end

  def test_strict_decode64
    assert_send_type '(String) -> String',
                     Base64, :strict_decode64, 'aGVsbG8gd29ybGQ='
  end

  def test_strict_encode64
    assert_send_type '(String) -> String',
                     Base64, :strict_encode64, 'hello world'
  end

  def test_urlsafe_decode64
    assert_send_type '(String) -> String',
                     Base64, :urlsafe_decode64, 'aGVsbG8gd29ybGQ='
  end

  def test_urlsafe_encode64
    assert_send_type '(String) -> String',
                     Base64, :urlsafe_encode64, 'hello world'
    assert_send_type '(String, padding: bool) -> String',
                     Base64, :urlsafe_encode64, '*', padding: false
  end
end