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

More language tests needed + examples,test cleanup. #132

Open
alsonkemp opened this issue Apr 25, 2012 · 3 comments
Open

More language tests needed + examples,test cleanup. #132

alsonkemp opened this issue Apr 25, 2012 · 3 comments
Labels

Comments

@alsonkemp
Copy link
Collaborator

I'm working on the parser and many of the language's features seem to be lacking sample code. Examples:

In CallArgument:
["[| expression |]", n("$$ = new yy.Quoted($2);")],

In Type Function:
["FUNCTION ( optTypeFunctionArgList )", "$$ = new yy.TypeFunction($3);"],

(Aha, I see an example of [| |] in examples/macro.roy...)

It would be very helpful to have a thorough and unified set of test cases. Also, you/we might merge most of examples/ into tests/ since many examples would be useful as tests, too. examples/ should probably hold larger pieces of code that demonstrate the overall language.

I'm happy to do this task if you think it would be beneficial.

@puffnfresh
Copy link
Owner

I stuffed up a while ago and tried writing my own test runner for Roy instead of using an existing one.

I need to start testing the non-happy paths and more of the compiler internals. I'll start doing that in the coming months - any improvements in the meantime are greatly welcomed.

@alsuren
Copy link

alsuren commented Jun 11, 2012

I think that this is related: Some of the example code itself is broken:

data Either a b =
  Left a | Right b

let printString (s: String) =
  console.log s

let printResult e = match e
  case (Left x) = console.log x
  case (Right x) = printString x

printResult (Left 10)
printResult (Right "Error")

// Won't compile:
printResult (Right 10)

actually compiles fine.

Do we need some kind of test runner that goes through the examples and uncomments each "// Won't compile" block in turn and makes sure it doesn't compile?

@alsuren
Copy link

alsuren commented Jun 11, 2012

To clarify: found this code in the "tagged union" section of http://roy.brianmckenna.org/, and uncommented the last line.

I just pasted this into repl.it and it broke as expected.

I'm new to this language, so I don't really know what's broken here/which versions are broken.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants