diff --git a/CHANGELOG.md b/CHANGELOG.md index 020ee33d3..e617babad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/build.bat b/build.bat index 941c34c87..7ca28d255 100644 --- a/build.bat +++ b/build.bat @@ -1,5 +1,5 @@ @echo off -set "picklesVersion=2.16.0" +set "picklesVersion=2.16.1" cls diff --git a/src/Pickles/Pickles.BaseDhtmlFiles/js/featureSearch.js b/src/Pickles/Pickles.BaseDhtmlFiles/js/featureSearch.js index c18caf099..b790d29d0 100644 --- a/src/Pickles/Pickles.BaseDhtmlFiles/js/featureSearch.js +++ b/src/Pickles/Pickles.BaseDhtmlFiles/js/featureSearch.js @@ -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; diff --git a/src/Pickles/Pickles.Test/CultureAwareDialectProviderTests.cs b/src/Pickles/Pickles.Test/CultureAwareDialectProviderTests.cs new file mode 100644 index 000000000..3a42c93de --- /dev/null +++ b/src/Pickles/Pickles.Test/CultureAwareDialectProviderTests.cs @@ -0,0 +1,80 @@ +// -------------------------------------------------------------------------------------------------------------------- +// +// 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. +// +// -------------------------------------------------------------------------------------------------------------------- + +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) + { + } + } + } +} \ No newline at end of file diff --git a/src/Pickles/Pickles.Test/Pickles.Test.csproj b/src/Pickles/Pickles.Test/Pickles.Test.csproj index ae3c68c77..54d7d2a88 100644 --- a/src/Pickles/Pickles.Test/Pickles.Test.csproj +++ b/src/Pickles/Pickles.Test/Pickles.Test.csproj @@ -99,6 +99,7 @@ + diff --git a/src/Pickles/Pickles/CultureAwareDialectProvider.cs b/src/Pickles/Pickles/CultureAwareDialectProvider.cs index 9465d908e..19cd5826a 100644 --- a/src/Pickles/Pickles/CultureAwareDialectProvider.cs +++ b/src/Pickles/Pickles/CultureAwareDialectProvider.cs @@ -31,16 +31,25 @@ public CultureAwareDialectProvider(string defaultLanguage) : base(defaultLanguag { } - public override GherkinDialect GetDialect(string language, Location location) + /// We need to override only this method. The overload without + /// Dictionary internally calls this method. + protected override GherkinDialect GetDialect(string language, + Dictionary gherkinLanguageSettings, Location location) { - string languageOnly = StripCulture(language); - return base.GetDialect(languageOnly, location); - } + GherkinDialect result; - protected override GherkinDialect GetDialect(string language, Dictionary 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) diff --git a/src/Pickles/VersionInfo.cs b/src/Pickles/VersionInfo.cs index e8a61f0c7..26f95d831 100644 --- a/src/Pickles/VersionInfo.cs +++ b/src/Pickles/VersionInfo.cs @@ -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"; @@ -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"; } }