Sha256: 2744ec41ae1db0bd12c7d80266f15d2a635f3fcb064a2bc584d65c8ba485231c

Contents?: true

Size: 418 Bytes

Versions: 6

Compression:

Stored size: 418 Bytes

Contents

require 'spec_helper'

describe 'Regular expressions' do
  def self.should_match(num, rgx, str)
    it 'ex' + num.to_s do
      expect(rgx =~ str).to eq(0)
    end
  end
  describe 'function' do
    should_match(1, /[fgh]\(\w( ?, ?\w)*\) ?= ?[^\r\n]+/, 'f(x) = xy')
  end

  describe 'differentiate' do
    rgx = /d\/d[a-zA-Z] .*/
    should_match(1, rgx, 'd/dx sin(x)')
    should_match(2, rgx, 'd/dz z^2')
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
qlang-0.0.27180000 spec/lexer/regular_expressions_spec.rb
qlang-0.0.27100000 spec/lexer/regular_expressions_spec.rb
qlang-0.0.27000000 spec/lexer/regular_expressions_spec.rb
qlang-0.0.27 spec/lexer/regular_expressions_spec.rb
qlang-0.0.14142135 spec/lexer/regular_expressions_spec.rb
qlang-0.0.1414213 spec/lexer/regular_expressions_spec.rb