forked from fable-compiler/Fable
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Python] Fix char to string regression and add tests (fable-compiler#…
…3588) * Fix python char typing issue
- Loading branch information
Showing
8 changed files
with
78 additions
and
29 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "fable-library" | ||
version = "0.8.0" | ||
version = "0.9.0" | ||
description = "Fable library for Python" | ||
authors = ["Dag Brattli <[email protected]>"] | ||
license = "MIT License" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module Fable.Tests.AnonRecordTests | ||
|
||
open Util.Testing | ||
|
||
let anonRecAcceptingFn (x: {|A: int; B: string|}) = | ||
{|C = x.A + 1; D = "Z"|} | ||
|
||
let structAnonRecAcceptingFn (x: struct {|A: int; B: string|}) = | ||
struct {|C = x.A + 1; D = "Z"|} | ||
|
||
[<Fact>] | ||
let ``test Anonimous records work`` () = | ||
let r = {| A = 1; B = "hello"; X = 3.141; D = 4|} | ||
r.A |> equal 1 | ||
r.X |> equal 3.141 //just in case alphabetical ordering is going to throw off index | ||
r.B |> equal "hello" | ||
r.D |> equal 4 | ||
|
||
[<Fact>] | ||
let ``test Anonimous records can pe passed as parameters`` () = | ||
let m = {| A = 1; B = "hello"|} | ||
let res = anonRecAcceptingFn m | ||
res.C |> equal 2 | ||
res.D |> equal "Z" | ||
|
||
[<Fact>] | ||
let ``test Anonimous records structural equality works`` () = | ||
let a = {| A = 1; B = "hello"|} | ||
let b = {| A = 1; B = "hello"|} | ||
let c = {| A = 2; B = "test"|} | ||
a = a |> equal true | ||
a = b |> equal true | ||
a = c |> equal false | ||
b = c |> equal false | ||
|
||
[<Fact>] | ||
let ``test Struct anonimous records work`` () = | ||
let r = struct {| A = 1; B = "hello"; X = 3.141; D = 4|} | ||
r.A |> equal 1 | ||
r.X |> equal 3.141 //just in case alphabetical ordering is going to throw off index | ||
r.B |> equal "hello" | ||
r.D |> equal 4 | ||
|
||
[<Fact>] | ||
let ``test Struct anonimous records can pe passed as parameters`` () = | ||
let m = struct {| A = 1; B = "hello"|} | ||
let res = structAnonRecAcceptingFn m | ||
res.C |> equal 2 | ||
res.D |> equal "Z" | ||
|
||
[<Fact>] | ||
let ``test Struct anonimous records structural equality works`` () = | ||
let a = struct {| A = 1; B = "hello"|} | ||
let b = struct {| A = 1; B = "hello"|} | ||
let c = struct {| A = 2; B = "test"|} | ||
a = a |> equal true | ||
a = b |> equal true | ||
a = c |> equal false | ||
b = c |> equal false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters