Skip to content
This repository has been archived by the owner on Jun 23, 2018. It is now read-only.

Commit

Permalink
Add a test for structural typing
Browse files Browse the repository at this point in the history
  • Loading branch information
UnkindPartition authored and mands committed Jul 1, 2017
1 parent 1634dd5 commit 0a1e61d
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 0 deletions.
12 changes: 12 additions & 0 deletions demos/Demo.Struct/module.nml
@@ -0,0 +1,12 @@
// Test structural typing
// see https://github.com/nstack/nstack-server/issues/571
module Demo.Struct:0.0.1-SNAPSHOT

type V1 = A Integer
| B { b1 : Integer, b2 : Text, b3 : Boolean }
type V2 = B { b3 : Boolean, b2 : Text, b1 : Integer }
| A Integer

fun test0 : V1 -> Integer

def test1 = Conv.from_json<V2> | test0
15 changes: 15 additions & 0 deletions demos/Demo.Struct/nstack.yaml
@@ -0,0 +1,15 @@
# The language stack to use
stack: Python

# Parent Image
parent: nstack/NStack.Python:0.25.0

# (Optional) System-level packages needed
packages: []

# (Optional) Commands to run when building the service (Bash-compatible)
commands: []

# (Optional) Files/Dir to copy across into the service (can use regex/glob syntax)
files: []

Empty file.
10 changes: 10 additions & 0 deletions demos/Demo.Struct/service.py
@@ -0,0 +1,10 @@
#!/usr/bin/env python3
"""
Demo.Struct:0.0.1-SNAPSHOT Service
"""
import nstack

class Service(nstack.BaseService):
def numChars(self, x):
return 0

Empty file added demos/Demo.Struct/setup.py
Empty file.
1 change: 1 addition & 0 deletions demos/nstack-test-Demos.yaml
Expand Up @@ -4,6 +4,7 @@ module_dirs:
- Demo.NumChars
- Demo.DigitString
- Demo.Workflow
- Demo.Struct

tests:
- name: demo_classify
Expand Down

0 comments on commit 0a1e61d

Please sign in to comment.