refactor: move language examples to fixture files

This commit is contained in:
Paul Gauthier (aider) 2024-11-27 07:03:20 -08:00
parent 565f08a8e9
commit 4de8c25a3f
5 changed files with 148 additions and 144 deletions

38
tests/fixtures/languages/elm/test.elm vendored Normal file
View file

@ -0,0 +1,38 @@
module Main exposing (main, Person, Greeting)
import Html exposing (Html, div, text)
import Html.Attributes exposing (class)
type alias Person =
{ name : String
, age : Int
}
type Greeting
= Formal
| Casual
greet : Greeting -> Person -> String
greet style person =
let
prefix =
case style of
Formal ->
"Good day"
Casual ->
"Hi"
in
prefix ++ ", " ++ person.name ++ "!"
defaultPerson : Person
defaultPerson =
{ name = "World"
, age = 42
}
main : Html msg
main =
div [ class "greeting" ]
[ text (greet Formal defaultPerson)
]