Skip to content

Commit 673d1a3

Browse files
Copilotsupermario
andcommitted
Add comprehensive WebGL.Texture test validation for both success and error cases
Co-authored-by: supermario <102781+supermario@users.noreply.github.com>
1 parent 199766f commit 673d1a3

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

test/Test.hs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,8 @@ import qualified Test.Ext.ElmPages.Check
2121
import qualified Test.TypeHashes
2222
import qualified Test.JsOutput
2323
import qualified Test.WebGL
24-
<<<<<<< HEAD
2524
import qualified Test.Lamdera.Live
26-
=======
2725
import qualified Test.BackwardsCompat
28-
>>>>>>> bdcb71f7 (Test Lamdera HTML injections don't happen on vanilla Elm projects)
2926

3027
import qualified Test.Lamdera.Evergreen.TestMigrationHarness
3128
import qualified Test.Lamdera.Evergreen.TestMigrationGenerator

test/Test/WebGL.hs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,14 @@ suite = tests
4646
actual <- catchOutput $ Lamdera.Compile.makeDev project [ "src/Frontend.elm", "src/Backend.elm", "src/Types.elm" ]
4747

4848
expectTextContains actual "Success! Compiled 3 modules."
49+
50+
, scope "compilation should fail with WebGL.Texture in backend contexts" $ do
51+
project <- io $ Lamdera.Relative.requireDir "test/scenario-webgl-texture"
52+
53+
_ <- io $ rmdir (project </> "elm-stuff")
54+
55+
actual <- catchOutput $ Lamdera.Compile.makeDev project [ "src/TestBadWebGL.elm" ]
56+
57+
-- Should fail with kernel error for browser-only types
58+
expectTextContains actual "can only be used in the frontend"
4959
]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module TestBadWebGL exposing (..)
2+
3+
-- This should fail compilation because WebGL.Texture is in ToBackend
4+
import WebGL.Texture as Texture
5+
6+
7+
type ToBackend
8+
= SendTexture Texture.Texture -- This should cause an error
9+
10+
11+
type alias BackendModel =
12+
{ texture : Maybe Texture.Texture -- This should also cause an error
13+
}

0 commit comments

Comments
 (0)