Sha256: f064791b4178d23e4bf4cabe350efadc5acddda52f47986a16ce632ecca0e09c

Contents?: true

Size: 873 Bytes

Versions: 8

Compression:

Stored size: 873 Bytes

Contents

require 'test/unit/testcase'
require 'wlang'
require 'wlang/rulesets/basic_ruleset'
require 'wlang/rulesets/context_ruleset'

# Tests the Scoping ruleset
class WLang::ContextRuleSetTest < Test::Unit::TestCase

  # Installs a dialect on wlang
  def setup
    WLang::dialect "context-test" do 
      rules WLang::RuleSet::Basic
      rules WLang::RuleSet::Context
    end
  end
  
  # Tests the define decoder
  def test_block_assignment
    tests = [
      ["#={code}{hello}+{code}", "hello"],
      ["#={code}{hello}{+{code}}", "hello"],
      ["#={code}{%{wlang/dummy}{hello}}{+{code}}", "hello"],
      ["#={code}{%{wlang/dummy}{+{hello}}}{+{code}}", "+{hello}"]
    ]
    tests.each do |test|
      template, expected = test
      result = template.wlang(nil, "context-test")
      assert_equal(expected, result)
    end
  end
    
end # class WLang::ScopingRuleSetTest

Version data entries

8 entries across 7 versions & 1 rubygems

Version Path
wlang-0.10.2 test/unit/wlang/context_ruleset_test.rb
wlang-0.10.1 ./test/unit/wlang/context_ruleset_test.rb
wlang-0.10.1 test/unit/wlang/context_ruleset_test.rb
wlang-0.10.0 test/unit/wlang/context_ruleset_test.rb
wlang-0.9.2 test/unit/wlang/context_ruleset_test.rb
wlang-0.8.5 test/wlang/context_ruleset_test.rb
wlang-0.8.4 test/wlang/context_ruleset_test.rb
wlang-0.9.1 test/unit/wlang/context_ruleset_test.rb