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
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"log" | |
"os" | |
) | |
type ShoppingRecord struct { |
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
package entity | |
type Person struct { | |
name string | |
age int | |
profImg []byte | |
} | |
func NewPerson(name string, age int, profimg []byte) *Person { | |
return &Person{ |
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
package main | |
import ( | |
"fmt" | |
"gitlab.mapan.io/irfanhanif/playground/entity" | |
) | |
func main() { | |
p := entity.NewPerson("Arhan Nadeo", 23, []byte(`sebuah gambar`)) |
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
package entity | |
type Person struct { | |
name string | |
age int | |
profImg []byte // potensi size besar di sini | |
} | |
func NewPerson(name string, age int, profimg []byte) *Person { | |
return &Person{ |
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
package main | |
import ( | |
"fmt" | |
"github.com/irfanhanif/playground/entity" | |
) | |
func main() { | |
p := entity.NewPerson("Arhan Nadeo", 23, []byte(`sebuah gambar`)) |
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
package main | |
import "fmt" | |
type Person struct { | |
Name string | |
Age int | |
} | |
func main() { |
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
package main | |
import "fmt" | |
type Person struct { | |
Name string | |
Age int | |
} | |
func main() { |
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
Code.require_file("ex_unit_extended.ex", __DIR__) | |
defmodule AppleBasketTest do | |
use ExUnit.Case | |
use ExUnitExtended | |
test "add_apple/1 add apple to a basket" do | |
given__(:an_apple_basked_that_consists_of_2_apples_with_maximum_capacity_of_5_apples) | |
|> when__(:i_add_1_apple_to_the_basket) | |
|> then__("The basket should have", :total_of_3_apples_in_the_basket) |
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
Code.require_file("ex_unit_extended.ex", __DIR__) | |
defmodule AppleBasketTest do | |
use ExUnit.Case | |
use ExUnitExtended | |
test "add_apple/1 add apple to a basket" do | |
given__(:an_apple_basked_that_consists_of_2_apples_with_maximum_capacity_of_5_apples) | |
|> when__(:i_add_1_apple_to_the_basket) | |
|> then__("The basket should have", :total_of_3_apples_in_the_basket) |
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
defmodule ExUnitExtended do | |
defmacro __using__(_) do | |
quote do | |
def given__(given_function_name) do | |
apply(__MODULE__.Given, given_function_name, []) | |
end | |
def when__(data_from_given_statement, test_function_name) do | |
apply(__MODULE__.When, test_function_name, [data_from_given_statement]) | |
end |
NewerOlder