Comments (7)
FYI, the current Otto revision I'm testing is 04ea4a2. The one we've been using that works fine is adf21d0 from 5/15 ("No rush to change the interface of Value.Export()"). I'm running Go 1.1 on Mac OS X 10.8.4.
from otto.
If I call value.Type()
at the start of ottoValueToStringArray()
, the result is "GoArray"
. So it looks like the problem is in converting a JS GoArray back into a native Go array.
from otto.
Sorry about that. The problem is (probably) around here:
https://github.com/robertkrimen/otto/blob/master/value.go#L625
This is the commit that "broke" it:
We have different types for a Go slice versus a Go array, now.
I'm not sure exactly why the export tests did not catch this, though...
from otto.
Maybe line 628 should read
if object.class == "Array” || object.class == “GoArray” {
?
from otto.
Yeah, that fixed it.
from otto.
The bug isn't fixed. My test is still failing — it's that assertion that I commented out when pasting it above. The result of Export is now correctly a string array, but unfortunately its value is nil :(
channelmapper_test.go:33
assert.DeepEquals(t, strings, []string{"foo", "bar", "baz"})
expected: []string{"foo", "bar", "baz"}
got: []string(nil)
--- FAIL: TestOttoValueToStringArray (0.08 seconds)
The unit test you added (Test_issue24) doesn't catch this because it only verifies the return type, not the actual value.
from otto.
Oops, never mind — my own code was broken (it was still expecting Value to return []interface{}, not []string!)
from otto.
Related Issues (20)
- parser.ParseFile difference between []byte and file HOT 2
- Compile throws error HOT 3
- JS VM crashing go HOT 2
- Errors caused by different go versions HOT 3
- TestBinaryShiftOperation test fails HOT 31
- Parser don't allow leading 0 HOT 8
- `panic: strconv.ParseInt: parsing "toJSON": invalid syntax` on `ToValue` a `map` HOT 3
- new Date can't not parse datetime string HOT 2
- Memory is slowly increasing until OOM HOT 4
- "use strict" is not in effect HOT 7
- Overview of extending thrid party packages
- Implementation of the export and import keywords to support, amongst others, unit tests. HOT 3
- dates and timezone HOT 1
- How do I call a function that I extract from other javascript code
- Doe this framework support wsam? HOT 1
- fatal error: concurrent map write HOT 5
- How to obtain the values of jump related variables such as window.location.href?
- 多线程的时候会报错 HOT 2
- Code generator: AST ⇒ javascript code HOT 3
- Value of json expression is `undefined` HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from otto.