Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Rombauts committed Aug 7, 2017
2 parents c902938 + 5f85883 commit 55dfd1b
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 15 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ Features in Experimental are subject to change and removal without being conside

This document is formatted according to the principles of [Keep A CHANGELOG](http://keepachangelog.com).

## [2.16.1] - 2017-08-07

### Fixed

- Remove unnecessary backslash conversion in json feature tree ([469](https://github.com/picklesdoc/pickles/pull/469)) (by [@AntoineTheb](https://github.com/AntoineTheb))
- Pickles cannot deal with languages that have a hyphen in the name ([478](https://github.com/picklesdoc/pickles/pull/478)) (by [@dirkrombauts](https://github.com/dirkrombauts))

## [2.16.0] - 2017-06-06

### Added
Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
set "picklesVersion=2.16.0"
set "picklesVersion=2.16.1"

cls

Expand Down
2 changes: 0 additions & 2 deletions src/Pickles/Pickles.BaseDhtmlFiles/js/featureSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ function getFeaturesMatching(searchString, features) {
}

function findFeatureByRelativeFolder(path, features) {
// make sure path is not url encoded, and replace forward-slashes with back-slashes to match JSON
path = decodeURIComponent(path);
path = path.replace(/\//g, '\\');

var feature = _.find(features, function(featureTesting) {
return featureTesting.RelativeFolder == path;
Expand Down
80 changes: 80 additions & 0 deletions src/Pickles/Pickles.Test/CultureAwareDialectProviderTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CultureAwareDialectProviderTests.cs" company="PicklesDoc">
// Copyright 2011 Jeffrey Cameron
// Copyright 2012-present PicklesDoc team and community contributors
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;
using Gherkin;
using Gherkin.Ast;
using NFluent;
using NUnit.Framework;

namespace PicklesDoc.Pickles.Test
{
[TestFixture]
public class CultureAwareDialectProviderTests
{
[Test]
public void GetDialect_WithSimpleLanguage_ReturnsThatLanguage()
{
var provider = CreateCultureAwareDialectProvider();

var dialect = provider.GetDialect("nl", new Location());

Check.That(dialect.Language).IsEqualTo("nl");
}

private static TestableCultureAwareDialectProvider CreateCultureAwareDialectProvider()
{
var provider = new TestableCultureAwareDialectProvider("en");
return provider;
}

[Test]
public void GetDialect_WithLanguageAndCulture_ReturnsThatLanguage()
{
var provider = CreateCultureAwareDialectProvider();

var dialect = provider.GetDialect("nl-BE", new Location());

Check.That(dialect.Language).IsEqualTo("nl");
}

[Test]
public void GetDialect_WithLanguageThatIncludesHyphen_ReturnsThatLanguage()
{
var provider = CreateCultureAwareDialectProvider();

var dialect = provider.GetDialect("en-lol", new Location());

Check.That(dialect.Language).IsEqualTo("en-lol");
}

private class TestableCultureAwareDialectProvider : CultureAwareDialectProvider
{
internal new GherkinDialect GetDialect(string language, Location location)
{
return base.GetDialect(language, location);
}

public TestableCultureAwareDialectProvider(string defaultLanguage) : base(defaultLanguage)
{
}
}
}
}
1 change: 1 addition & 0 deletions src/Pickles/Pickles.Test/Pickles.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
<Compile Include="AssertExtensions.cs" />
<Compile Include="BaseFixture.cs" />
<Compile Include="ConfigurationTests.cs" />
<Compile Include="CultureAwareDialectProviderTests.cs" />
<Compile Include="DataStructures\TreeTests.cs" />
<Compile Include="DescriptionProcessorTests.cs" />
<Compile Include="DirectoryCrawlers\ImageFileDetectorTests.cs" />
Expand Down
25 changes: 17 additions & 8 deletions src/Pickles/Pickles/CultureAwareDialectProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,25 @@ public CultureAwareDialectProvider(string defaultLanguage) : base(defaultLanguag
{
}

public override GherkinDialect GetDialect(string language, Location location)
/// <remarks>We need to override only this method. The overload without
/// Dictionary internally calls this method.</remarks>
protected override GherkinDialect GetDialect(string language,
Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
{
string languageOnly = StripCulture(language);
return base.GetDialect(languageOnly, location);
}
GherkinDialect result;

protected override GherkinDialect GetDialect(string language, Dictionary<string, GherkinLanguageSetting> gherkinLanguageSettings, Location location)
{
string languageOnly = StripCulture(language);
return base.GetDialect(languageOnly, gherkinLanguageSettings, location);
try
{
result = base.GetDialect(language, gherkinLanguageSettings, location);
}
catch (NoSuchLanguageException)
{
string languageOnly = StripCulture(language);

result = base.GetDialect(languageOnly, gherkinLanguageSettings, location);
}

return result;
}

private string StripCulture(string language)
Expand Down
8 changes: 4 additions & 4 deletions src/Pickles/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
[assembly: AssemblyTrademarkAttribute("")]
[assembly: AssemblyCultureAttribute("")]
[assembly: ComVisibleAttribute(false)]
[assembly: AssemblyVersionAttribute("2.16.0")]
[assembly: AssemblyFileVersionAttribute("2.16.0")]
[assembly: AssemblyVersionAttribute("2.16.1")]
[assembly: AssemblyFileVersionAttribute("2.16.1")]
namespace System {
internal static class AssemblyVersionInformation {
internal const System.String AssemblyProduct = "Pickles";
Expand All @@ -18,7 +18,7 @@ internal static class AssemblyVersionInformation {
internal const System.String AssemblyTrademark = "";
internal const System.String AssemblyCulture = "";
internal const System.Boolean ComVisible = false;
internal const System.String AssemblyVersion = "2.16.0";
internal const System.String AssemblyFileVersion = "2.16.0";
internal const System.String AssemblyVersion = "2.16.1";
internal const System.String AssemblyFileVersion = "2.16.1";
}
}

0 comments on commit 55dfd1b

Please sign in to comment.