Sha256: 342f7e85b3601dd7dffeb43aae1049b5737b9541d50a751b4585adf4685e95d3

Contents?: true

Size: 976 Bytes

Versions: 3

Compression:

Stored size: 976 Bytes

Contents

#!/usr/bin/env ruby

require 'test/unit'
currentPath = File.dirname(__FILE__)
require File.join( currentPath, '../../lib/masterview' )

class TestDirectiveBase < Test::Unit::TestCase
  def setup
    @base = MasterView::DirectiveBase.new('')
  end

  def test_quote
    assert_equal '\'hello\'', @base.quote('hello')
  end

  def test_quote_if
    assert_equal '\'helloWorld0123\'', @base.quote_if('helloWorld0123')
    assert_equal 'hello world', @base.quote_if('hello world')
    assert_equal 'hello,world', @base.quote_if('hello,world')
    assert_equal 'hello(world)', @base.quote_if('hello(world)')
    assert_equal ':hello', @base.quote_if(':hello')
    assert_equal '\"hello world\"', @base.quote_if('\"hello world\"')
    assert_equal '%q{helloworld}', @base.quote_if('%q{helloworld}')
    assert_equal 'hello.world', @base.quote_if('hello.world')
    assert_equal 'hel/lo.w_orld', @base.quote_if('hel/lo.w_orld')
    assert_equal '\'\'', @base.quote_if('')
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
masterview-0.2.5 test/unit/directive_base_test.rb
masterview-0.2.3 test/unit/directive_base_test.rb
masterview-0.2.4 test/unit/directive_base_test.rb