Sha256: 1eeb007cdd252c0949c423c19d3109977a9d549e6486c7e845c706bb5a941268
Contents?: true
Size: 889 Bytes
Versions: 13
Compression:
Stored size: 889 Bytes
Contents
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') require "knj/strings" require "knj/errors" describe "Strings" do it "regex" do regex = Knj::Strings.regex("/(\d+)/i") raise "Regex should be '(?i-mx:(d+))' but wasnt: '#{regex}'." if "#{regex}" != "(?i-mx:(d+))" regex = Knj::Strings.regex("/\d+/") raise "Regex should be '(?-mix:d+)' but wasnt: '#{regex}'." if "#{regex}" != "(?-mix:d+)" begin regex = Knj::Strings.regex("/\d+/U") raise "Ruby doesnt support the U-modifier - an exception should be thrown!" rescue ArgumentError #this should happen - Ruby doesnt support U-modifier... end res = Knj::Strings.is_regex?("Kasper") raise "Expected res to be false but it wasnt." if res res = Knj::Strings.is_regex?("/^Kasper$/") raise "Expected res to be true but it wasnt." if !res end end
Version data entries
13 entries across 13 versions & 1 rubygems