Sha256: 038430788bde329d227693903968c84ba9d7f2df4d89b9e62965bbb7e1fe9dea

Contents?: true

Size: 790 Bytes

Versions: 12

Compression:

Stored size: 790 Bytes

Contents

# encoding: utf-8

require 'helper'

class TlsTest < Test::Unit::TestCase
  thread_local_attribute :tester
  thread_local_attribute :dynamic do  "dynamic" end
  thread_local_attribute :dynamic2 do "dynamic2" end
  
  def test_get_and_set
    assert_equal(nil, TlsTest.tester)
    TlsTest.tester = 1
    assert_equal(1, TlsTest.tester)

    assert_equal("dynamic", TlsTest.dynamic)
  end
  
  def test_thread_locality
    Thread.new {
      assert_equal(nil, TlsTest.tester)
      TlsTest.tester = 1
      assert_equal(1, TlsTest.tester)

      assert_equal("dynamic", TlsTest.dynamic)
    }.join
    
    Thread.new {
      assert_equal(nil, TlsTest.tester)
      TlsTest.tester = 1
      assert_equal(1, TlsTest.tester)

      assert_equal("dynamic", TlsTest.dynamic)
    }.join
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
radiospieler-0.3.0 test/tls_test.rb
radiospiel-app-0.2.10 test/tls_test.rb
radiospiel-app-0.2.9 test/tls_test.rb
radiospiel-app-0.2.7 test/tls_test.rb
radiospiel-app-0.2.6 test/tls_test.rb
radiospiel-app-0.2.5 test/tls_test.rb
radiospiel-app-0.2.3 test/tls_test.rb
radiospiel-app-0.2.2 test/tls_test.rb
radiospiel-app-0.2.1 test/tls_test.rb
radiospiel-app-0.2.0 test/tls_test.rb
radiospiel-app-0.1.1 test/tls_test.rb
radiospiel-app-0.1.0 test/tls_test.rb