Test bin

From Erights

Revision as of 22:58, 14 May 2009 by Kevin Reid (Talk | contribs)
Jump to: navigation, search

This page is for E implementation conformance tests for which a more specific location has not yet been found.

Contents

Expansion of bind

? def x
# value: <Resolver>

? bind x {}
# value: <x>

? x.__getAllegedType().getFQName()
# value: "__main$x"

Expansion of map pattern

? def a := "43"
# value: "43"

? def b :int := a
# problem: <ClassCastException: String doesn't coerce to an int>

? def [b :int] := [a]
# problem: <ClassCastException: String doesn't coerce to an int>

? def ["" => b :int] := ["" => a]
# problem: <ClassCastException: String doesn't coerce to an int>

? def ["x" => _] := ["" => a]
# problem: x not found

Serialization

? pragma.syntax("0.9")
> pragma.enable("accumulator")

? def makeSurgeon := <elib:serial.makeSurgeon>
# value: <makeSurgeon>

? def surgeons := ["default" => makeSurgeon(), "src" => makeSurgeon.withSrcKit(null)]
# value: ["default" => <surgeon>, "src" => <readOnlySurgeon>]

? def check(x, ignore) {
>   def diffs := accum [].asMap() for k => surgeon in surgeons { _.with(k,
>     def y := surgeon.unserialize(surgeon.serialize(x))
>     accum [] for check ? (!ignore.contains(check)) => r ? (!r) in [
>       "same"  => x == y,
>       "equiv" => !x.__respondsTo("compareTo",1) || x <=> y,
>       "print" => E.toString(x) == E.toString(y)
>     ] { _.with([check, x, y]) }
>   )}
>   return accum [].asMap() for k => v ? (v !~ []) in diffs { _.with(k, v) }
> }
# value: <check>

? check(1, [])
# value: [].asMap()

? check([1,2,3], [])
# value: [].asMap()

? check(def x := [1,2,x], [])
# value: [].asMap()

? check(Guard, [])
# value: [].asMap()

? check(78452960457820936578390758342950673284590431267589324057832946723148963275893465783049856783294507632894506732158912365478567145683415063127849561839450768239032675890432675843294067538490576382590432764589320457832940732849507324893076849051326758903426758903265748329405678329056732895032764853290576438259063278590267589023157689023456784321905632748950634278590342675893214056732841095673214850934726589032467583904576823904561758463859340758329067430642891467389027548790365783567438567473287237458763289478945137536498671236478658920786905234876435187903524783452608079342580796345218076953410876913458079634512087963451208796345017890493578108793452107893451289073452178960345179802879345178693451025734689012768059341278695134278906543210453780216978690543214532786091453782619054386719023452187690134528076931248570691578034629132076845932145768032104657834521780690786934512673845120978603459123456712809341572680931457086293457806219, [])
# value: [].asMap()

? check([].diverge(), ["same"])
# value: [].asMap()

???

? E.toString(help(/** FOO */ def _{})).indexOf("FOO") != -1
# value: true

Regression tests

This used to hang on E-on-Java

? def T := nullOk[Tuple[any, T]]
# value: nullOk[Tuple[any, <***CYCLE***>]]

These used to reveal pointers on E-on-Java

? [].asMap()[<import:java.lang.makeObject>()]
# problem: <IndexOutOfBoundsException: <an Object> not found>

? 1.0.random()
# problem: <NoSuchMethodException: <a Double>.random/0>

???

? def l := [].diverge(char)
# value: [].diverge()

? l.append(['a', 'b', 'c'])

? l
# value: ['a', 'b', 'c'].diverge()

This used to fail to be rejected in E-on-Java

? { x + 1; def x := 2 }
# problem: Failed: Undefined variable: x

? {[x + 1, def x := 2]}
# problem: Failed: Undefined variable: x

As of 0.8.30d, the results of these were:

  # value: 2
  # value: [485, 2]
Personal tools
more tools