In reverse order (:-)
1.OK checking now.
Initially Looks like I missed a couple of additional tests (in Tests/100-basics) in the patch
? 062-string-substitution-fmt.cobra
? 070j-is-and-is-not.cobra
I'll pass them inline below
2.
Tests/100-basics/070-is-and-is-not.cobra
The change isnt intended to be temporary - the existing test uses an Object method specific to CLR thats not available in jvm
( Object.referenceEquals). the jvm version below changes to use an added CobraImp ( CobraCoreInternal method ) instead.
(possibly that change should also be in the Cobra RTL as a nod to a portable RTL but I'm deferring that for the moment
3. re COBRA_TECHSTRING_SEPARATOR
The mod env variable I made was just a a flag to specify multiline indented items to aid/allow readability - I actually think it would be preferable to default to this but thats not what we've done so far ...
The change you made means that someone wanting just (intelligible) multiline aligned indentation is goanna have to experiment a bit to get the right sequence (',\n\t ') for aligned indented multilines.
If you want arbitrary allowance of a separator I would prefer a a different env variable that specifies and overrides the (defaulted) separator along with a env variable for simply specifying effectively ' I want want each item aligned on separate lines'
code something like:
- Code: Select all
__toStringSep = Environment.getEnvironmentVariable('COBRA_TECHSTRING_SEPARATOR') ? _
if( Environment.getEnvironmentVariable('COBRA_INDENT_TECHSTRING') , ',\n\t ', ',') )
sep = __toStringSep
Missed tests
Tests/100-basics/062c-string-substitution-fmt.cobra
- Code: Select all
#.require. clr
# some simple string subst formatting tests - .Net format descriptions
namespace Test
class Test
def main
is shared
# formatting
mol as int = 42
assert '[mol:N]'=='42.00'
assert "[mol:N]"=='42.00'
# test some the old way without the escape syntax.
a=99
t = String.format('a = {0}[a]]', c'[')
assert t == r'a = [99]'
s10 = 'FMT:a = '+ ns'[' +'[a]]'
assert s10 == r'FMT:a = [99]'
Tests/100-basics/070j-is-and-is-not.cobra
- Code: Select all
#.require. jvm
namespace Test
class Test
def main
is shared
s as String = 'aoeu'
assert s is s
t1 as String = 'ao'
t2 as String = 'eu'
if s.length==4
# the condition forces t to be constructed at runtime
t as String = t1 + t2
else
t as String = ''
assert s==t
assert not CobraImp.referenceEquals(s, t)
assert s is not t
assert t is not s
# for primitives like int, "is" is synonymous with "==" (and "is not" -> "<>")
x as int = 5
assert 5 is 5 # .warning. value types
assert x is 5 # .warning. value types
assert 5 is x # .warning. value types
assert x == x # TODO warning. same variable
y as int = 5
assert x is y # .warning. value types
assert y is x # .warning. value types
y = 6
assert x is not y # .warning. value types