Skip to content

Commit

Permalink
🧼 Linter
Browse files Browse the repository at this point in the history
  • Loading branch information
heytherewill committed May 15, 2023
1 parent b016781 commit 6e71e8b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
7 changes: 0 additions & 7 deletions CookLangNet.Tests/CanonicalTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ open System.Collections.Generic
open Xunit
open YamlDotNet.Serialization
open YamlDotNet.Serialization.NamingConventions
open System

type CanonicalTestIngredient = { Name: string; quantity: int; units: string }

type Step =
| Ingredient of CanonicalTestIngredient
| Text of string

// NOTE: These can't be made into records because YamlDotNet
// requires an empty constructor.
Expand Down
4 changes: 2 additions & 2 deletions CookLangNet.Tests/Generators.fs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ let private transformIntoSingleLineString s =
if isNull s then
""
else
use reader = new StringReader(s)
use reader = StringReader(s)
let builder = StringBuilder()

let mutable shouldContinue = true
Expand Down Expand Up @@ -119,7 +119,7 @@ type Default =

static member NumericQuantity () =
Default.NormalPositiveFloat()
|> convert (fun x -> Numeric x.Get) (fun x -> match x with Numeric f -> NormalPositiveFloat f | _ -> failwith "")
|> convert (fun x -> Numeric x.Get) (fun x -> match x with Numeric f -> NormalPositiveFloat f | _ -> failwith "Textual Quantity wrongly used as Numeric")

static member Quantity () =
let toQuantity useNumeric textual numeric =
Expand Down
8 changes: 4 additions & 4 deletions CookLangNet.Tests/ParserTests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ open Generators
open System

/// Compares the outcome of a parser with an expected value.
let internal testParser parser stringToParse (expectedValue: 'a) =
let internal testParser parser stringToParse (expectedValue: 'Value) =
let parserResult = runParserOnString parser State.Empty "Test" stringToParse
match parserResult with
| Success(actualValue, _, _) -> (actualValue |> should equal expectedValue)
| Failure _ -> failwith "Parser failed"
| Failure (f, _, _) -> failwith (sprintf "Fail to parse string %s" f)

/// Compares the outcome of a parser with an expected value.
let internal testParserWithState (parser: Parser<'a, State>) stringToParse (expectedValue: 'a) (expectedState: State) =
let internal testParserWithState (parser: Parser<'Value, State>) stringToParse (expectedValue: 'Value) (expectedState: State) =
let parserResult = runParserOnString parser State.Empty "Test" stringToParse
match parserResult with
| Success(actualValue, actualState, _) ->
actualValue |> should equal expectedValue
actualState |> should equal expectedState
| Failure _ -> failwith "Parser failed"
| Failure (f, _, _) -> failwith (sprintf "Fail to parse string %s" f)

module CommentParser =
let internal testCommentParser stringToParse expectedValue =
Expand Down
2 changes: 1 addition & 1 deletion CookLangNet/Api.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module CookLangParser =

/// Parses a string into a `Recipe` object.
let ParseString stringToParse =
use reader = new StringReader(stringToParse)
use reader = StringReader(stringToParse)
let mutable parsedLines = []
let mutable lineToParse = reader.ReadLine()
let mutable err: string = null
Expand Down

0 comments on commit 6e71e8b

Please sign in to comment.