| 1 |
@issue |
| 2 |
Feature: Issue #361 -- UTF-8 File with BOM |
| 3 |
|
| 4 |
. Using step files with "Byte-Order Mark" (BOM) prefix |
| 5 |
. causes weird problems. |
| 6 |
. |
| 7 |
. FIXES ALSO: #300 |
| 8 |
. AFFECTED FILES: |
| 9 |
. * features/environment.py |
| 10 |
. * features/steps/*.py |
| 11 |
|
| 12 |
@setup |
| 13 |
Scenario: Feature Setup |
| 14 |
Given a new working directory |
| 15 |
And a file named "features/steps/reuse_steps.py" with: |
| 16 |
""" |
| 17 |
from behave4cmd0 import passing_steps |
| 18 |
""" |
| 19 |
And a file named "features/passing.feature" with: |
| 20 |
""" |
| 21 |
Feature: |
| 22 |
Scenario: |
| 23 |
Given a step passes |
| 24 |
Then a special step |
| 25 |
""" |
| 26 |
And a file named "behave.ini" with: |
| 27 |
""" |
| 28 |
[behave] |
| 29 |
show_timings = false |
| 30 |
""" |
| 31 |
|
| 32 |
|
| 33 |
@encoding.<encoding> |
| 34 |
@not.with_python.implementation=<exclude_pyimpl> |
| 35 |
Scenario Outline: Use step file with <case> |
| 36 |
Given a file named "features/steps/my_steps.py" and encoding="<encoding>" with: |
| 37 |
""" |
| 38 |
# -*- coding: <encoding> -*- |
| 39 |
''' |
| 40 |
<text>. |
| 41 |
''' |
| 42 |
from behave import step |
| 43 |
|
| 44 |
@step(u'a special step') |
| 45 |
def step_impl(context): |
| 46 |
pass |
| 47 |
""" |
| 48 |
When I run "behave -f plain features/passing.feature" |
| 49 |
Then it should pass with: |
| 50 |
""" |
| 51 |
1 scenario passed, 0 failed, 0 skipped |
| 52 |
2 steps passed, 0 failed, 0 skipped, 0 undefined |
| 53 |
""" |
| 54 |
And the command output should contain: |
| 55 |
""" |
| 56 |
Feature: |
| 57 |
Scenario: |
| 58 |
Given a step passes ... passed |
| 59 |
Then a special step ... passed |
| 60 |
""" |
| 61 |
And the command output should not contain: |
| 62 |
""" |
| 63 |
SyntaxError: invalid character in identifier |
| 64 |
""" |
| 65 |
|
| 66 |
Examples: |
| 67 |
| encoding | text | case | exclude_pyimpl | Comment | |
| 68 |
| UTF-8-sig | Ärgernis ist überall | UTF-8 encoding and BOM | pypy | pypy SyntaxError: UTF-8 with BOM | |
| 69 |
| latin1 | Café | Latin1 encoding | none | | |
| 70 |
| iso-8859-1 | Ärgernis ist überall | iso-8859-1 encoding | none | Alias for latin1 | |
| 71 |
| cp1252 | Ärgernis ist überall | cp1252 encoding | none | Windows: Western Europe | |
| 72 |
| cp1251 | Привет! (=hello) | cp1251 encoding (Russia)| none | Windows: Russia | |
| 73 |
| cp866 | Привет! (=hello) | cp688 encoding (Russia) | none | IBM866: Russia | |
| 74 |
| euc_jp | こんにちは (=hello) | euc_jp encoding (Japan) | none | Japanese | |
| 75 |
| gbk | 您好 (=hello) | gbk encoding (China) | none | Unified Chinese | |
| 76 |
| gb2312 | 您好 (=hello) | gb2312 encoding (China) | none | Simplified Chinese | |
| 77 |
|
| 78 |
# -- DISABLE EXAMPLE ROW: Pypy 4.x has SyntaxError with UTF-8 BOM |
| 79 |
# | UTF-8-sig | Ärgernis ist überall | UTF-8 encoding and BOM | | |