Skip to content

Commit

Permalink
glue tests are no longer hard-coded to Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
svcxc committed Nov 14, 2024
1 parent 157aaae commit 95b39ce
Show file tree
Hide file tree
Showing 126 changed files with 1,597 additions and 1,439 deletions.
31 changes: 31 additions & 0 deletions crates/glue/src/CGlue.roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
app [makeGlue] { pf: platform "../platform/main.roc" }

import pf.Types exposing [Types]
# import pf.Shape exposing [Shape, RocFn]
import pf.File exposing [File]
# import pf.TypeId exposing [TypeId]

makeGlue : List Types -> Result (List File) Str
makeGlue = \_typesByArch ->
Ok ([{ name: "roc_app.h", content: placeholderGlue }])

placeholderGlue =
"""
#ifndef ROC_APP_H
#define ROC_APP_H
#include <stdint.h>
extern void roc__mainForHost_1_exposed_generic(uint8_t *ret);
uint8_t roc_mainForHost()
{
uint8_t ret;
roc__mainForHost_1_exposed_generic(&ret);
return ret;
}
#endif
"""
87 changes: 0 additions & 87 deletions crates/glue/tests/fixtures/advanced-recursive-union/src/lib.rs

This file was deleted.

59 changes: 0 additions & 59 deletions crates/glue/tests/fixtures/arguments/src/lib.rs

This file was deleted.

81 changes: 0 additions & 81 deletions crates/glue/tests/fixtures/basic-record/src/lib.rs

This file was deleted.

92 changes: 0 additions & 92 deletions crates/glue/tests/fixtures/basic-recursive-union/src/lib.rs

This file was deleted.

3 changes: 3 additions & 0 deletions crates/glue/tests/fixtures/c/hello-world/app.roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
app [main] { pf: platform "platform.roc" }

main = 42
14 changes: 14 additions & 0 deletions crates/glue/tests/fixtures/c/hello-world/host.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>
#include <stdint.h>
#include <assert.h>

#include "test_glue/roc_app.h"

int main(void)
{
uint8_t mainForHost = roc_mainForHost();

printf("mainForHost = %i\n", mainForHost);

assert(mainForHost == 42);
}
9 changes: 9 additions & 0 deletions crates/glue/tests/fixtures/c/hello-world/platform.roc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
platform "test-platform"
requires {} { main : _ }
exposes []
packages {}
imports []
provides [mainForHost]

mainForHost : U8
mainForHost = main
Loading

0 comments on commit 95b39ce

Please sign in to comment.