Skip to content
This repository has been archived by the owner on Jun 1, 2024. It is now read-only.

Unit test for dataproviders with period in key #117

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ jobs:
# Run tests on all OS's and HHVM versions, even if one fails
fail-fast: false
matrix:
os: [ ubuntu ]
os: [ ubuntu-20.04 ]
hhvm:
- '4.168'
- latest
- nightly
runs-on: ${{matrix.os}}-latest
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v2
- name: Create branch for version alias
Expand Down
9 changes: 9 additions & 0 deletions tests/clean/provider/DataProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ public function testSimple(Traversable<arraykey> $traversable): void {
expect(Str\join($traversable, '-'))->toBeSame('the-quick-brown-fox-1');
}

public function provideWithPeriod()[]: dict<string, (string)> {
return dict['per.iod' => tuple('str')];
}

<<DataProvider('provideWithPeriod')>>
public function testPeriodInKey(string $v): void {
expect($v)->toEqual('str');
}

public function provideMultipleArgs(): vec<(int, int)> {
return vec[
tuple(1, 2),
Expand Down
24 changes: 24 additions & 0 deletions tests/dirty/DataProviderWithPeriodInKeyTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?hh // strict
/*
* Copyright (c) 2004-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/

use function Facebook\FBExpect\expect;
use type Facebook\HackTest\{DataProvider, HackTest};

// @oss-disable: <<Oncalls('hack')>>
final class DataProviderWithPeriodInKeyTest extends HackTest {
public function provideWithPeriod()[]: dict<string, (string)> {
return dict['per.iod' => tuple('str')];
}

<<DataProvider('provideWithPeriod')>>
public function testPeriodInKey(string $v): void {
expect($v)->toNotEqual('str');
}
}