| | 877 | def test_build_pattern_non_optional_with_no_captures |
|---|
| | 878 | # Non optioanl |
|---|
| | 879 | a_segment = ROUTING::DynamicSegment.new |
|---|
| | 880 | a_segment.regexp = /\d+/ #number_of_captures is 0 |
|---|
| | 881 | assert_equal "(\\d+)stuff", a_segment.build_pattern('stuff') |
|---|
| | 882 | end |
|---|
| | 883 | |
|---|
| | 884 | def test_build_pattern_non_optional_with_captures |
|---|
| | 885 | # Non optioanl |
|---|
| | 886 | a_segment = ROUTING::DynamicSegment.new |
|---|
| | 887 | a_segment.regexp = /(\d+)(.*?)/ #number_of_captures is 2 |
|---|
| | 888 | assert_equal "((\\d+)(.*?))stuff", a_segment.build_pattern('stuff') |
|---|
| | 889 | end |
|---|
| | 890 | |
|---|
| | 891 | def test_optionality_implied |
|---|
| | 892 | a_segment = ROUTING::DynamicSegment.new |
|---|
| | 893 | a_segment.key = :id |
|---|
| | 894 | assert a_segment.optionality_implied? |
|---|
| | 895 | |
|---|
| | 896 | a_segment.key = :action |
|---|
| | 897 | assert a_segment.optionality_implied? |
|---|
| | 898 | end |
|---|