Skip to content

Commit d2de31d

Browse files
committed
Fantomas
1 parent 3db406f commit d2de31d

File tree

7 files changed

+48
-38
lines changed

7 files changed

+48
-38
lines changed

.fantomasignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Build.fs
2+
Helpers.fs
3+
4+
# Ignore script files
5+
*.fsx

src/Ast.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,15 @@ type IExports =
111111
/// Parse the source into an AST node
112112
abstract parse : string -> AST
113113
abstract parse : string * filename: string -> AST
114-
abstract parse : string * filename: string * mode: Mode-> AST
114+
abstract parse : string * filename: string * mode: Mode -> AST
115115
abstract unparse : astObj: AST -> string
116116
abstract walk : node: AST -> AST array
117117
/// Return a formatted dump of the tree in node.
118-
abstract dump : node : AST -> string
118+
abstract dump : node: AST -> string
119119
/// Return a formatted dump of the tree in node.
120-
abstract dump : node : AST * annotate_fields : bool -> string
120+
abstract dump : node: AST * annotate_fields: bool -> string
121121
/// Return a formatted dump of the tree in node.
122-
abstract dump : node : AST * annotate_fields : bool * include_attributes: bool -> string
122+
abstract dump : node: AST * annotate_fields: bool * include_attributes: bool -> string
123123

124124
[<ImportDefault("ast")>]
125125
let ast: IExports = nativeOnly

src/Json.fs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
module Fable.Python.Json
2-
3-
open Fable.Core
4-
5-
// fsharplint:disable MemberNames,InterfaceNames
6-
7-
type IExports =
8-
abstract dumps : obj: obj -> string
9-
abstract loads : string -> obj
10-
11-
[<ImportDefault("json")>]
12-
let json: IExports = nativeOnly
1+
module Fable.Python.Json
2+
3+
open Fable.Core
4+
5+
// fsharplint:disable MemberNames,InterfaceNames
6+
7+
type IExports =
8+
abstract dumps : obj: obj -> string
9+
abstract loads : string -> obj
10+
11+
[<ImportDefault("json")>]
12+
let json: IExports = nativeOnly

test/Main.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#if FABLE_COMPILER
22
module Program
3+
34
()
45
#else
5-
module Program = let [<EntryPoint>] main _ = 0
6-
#endif
6+
module Program =
7+
[<EntryPoint>]
8+
let main _ = 0
9+
#endif

test/TestAst.fs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@ open Fable.Python.Ast
66
[<Fact>]
77
let ``test ast parse empty module works`` () =
88
let result = ast.parse ""
9-
result.GetType () |> equal typeof<AST>
9+
result.GetType() |> equal typeof<AST>
1010

1111
[<Fact>]
1212
let ``test ast parse assign works`` () =
1313
let result = ast.parse "a = 10" :?> Module
1414

1515
// Result is a list of statements
16-
result.body.[0].GetType () |> equal typeof<stmt>
16+
result.body.[0].GetType() |> equal typeof<stmt>
1717

1818
// The statement is an assign statement
1919
let assign = (result.body.[0] :?> Assign)
20-
assign.GetType () |> equal typeof<Assign>
21-
22-
20+
assign.GetType() |> equal typeof<Assign>

test/TestJson.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ let ``test works`` () =
1515

1616
[<Fact>]
1717
let ``test json dumps works`` () =
18-
let object = {| A=10; B=20 |}
19-
let result = json.dumps object
18+
let object = {| A = 10; B = 20 |}
19+
let result = json.dumps object
2020
result |> equal """{"A": 10, "B": 20}"""
2121

2222
[<Fact>]
2323
let ``test json loads works`` () =
2424
let input = """{"Foo": 10, "Bar": "test"}"""
25-
let object = {| Foo=10; Bar="test" |}
26-
let result : {| Foo: int; Bar: string |}= unbox (json.loads input)
25+
let object = {| Foo = 10; Bar = "test" |}
26+
let result: {| Foo: int; Bar: string |} = unbox (json.loads input)
2727
result |> equal object

test/Util.fs

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,28 @@ module Testing =
99

1010
type Assert =
1111
[<Emit("assert $0 == $1")>]
12-
static member AreEqual(actual: 'T, expected: 'T, ?msg: string): unit = nativeOnly
12+
static member AreEqual(actual: 'T, expected: 'T, ?msg: string) : unit = nativeOnly
13+
1314
[<Emit("assert not $0 == $1")>]
14-
static member NotEqual(actual: 'T, expected: 'T, ?msg: string): unit = nativeOnly
15+
static member NotEqual(actual: 'T, expected: 'T, ?msg: string) : unit = nativeOnly
1516

16-
let equal expected actual: unit = Assert.AreEqual(actual, expected)
17-
let notEqual expected actual: unit = Assert.NotEqual(actual, expected)
17+
let equal expected actual : unit = Assert.AreEqual(actual, expected)
18+
let notEqual expected actual : unit = Assert.NotEqual(actual, expected)
1819

19-
type Fact() = inherit System.Attribute()
20+
type Fact () =
21+
inherit System.Attribute ()
2022
#else
2123
open Xunit
2224
type FactAttribute = Xunit.FactAttribute
2325

24-
let equal<'T> (expected: 'T) (actual: 'T): unit = Assert.Equal(expected, actual)
26+
let equal<'T> (expected: 'T) (actual: 'T) : unit = Assert.Equal(expected, actual)
2527
let notEqual<'T> (expected: 'T) (actual: 'T) : unit = Assert.NotEqual(expected, actual)
2628
#endif
2729

28-
let rec sumFirstSeq (zs: seq<float>) (n: int): float =
29-
match n with
30-
| 0 -> 0.
31-
| 1 -> Seq.head zs
32-
| _ -> (Seq.head zs) + sumFirstSeq (Seq.skip 1 zs) (n-1)
30+
let rec sumFirstSeq (zs: seq<float>) (n: int) : float =
31+
match n with
32+
| 0 -> 0.
33+
| 1 -> Seq.head zs
34+
| _ ->
35+
(Seq.head zs)
36+
+ sumFirstSeq (Seq.skip 1 zs) (n - 1)

0 commit comments

Comments
 (0)