opal 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (93) hide show
  1. data/.travis.yml +5 -0
  2. data/README.md +42 -2
  3. data/Rakefile +7 -6
  4. data/bin/opal +2 -2
  5. data/{opal → corelib}/opal.rb +21 -21
  6. data/{opal → corelib}/opal/array.rb +37 -24
  7. data/{opal → corelib}/opal/basic_object.rb +0 -0
  8. data/{opal → corelib}/opal/boolean.rb +0 -0
  9. data/{opal → corelib}/opal/class.rb +45 -22
  10. data/{opal → corelib}/opal/comparable.rb +0 -0
  11. data/{opal → corelib}/opal/enumerable.rb +0 -0
  12. data/{opal → corelib}/opal/enumerator.rb +0 -0
  13. data/{opal → corelib}/opal/error.rb +16 -12
  14. data/{opal → corelib}/opal/hash.rb +2 -2
  15. data/{opal → corelib}/opal/kernel.rb +16 -14
  16. data/{opal → corelib}/opal/native.rb +0 -0
  17. data/{opal → corelib}/opal/nil_class.rb +1 -1
  18. data/{opal → corelib}/opal/numeric.rb +0 -0
  19. data/{opal → corelib}/opal/proc.rb +0 -0
  20. data/{opal → corelib}/opal/range.rb +2 -2
  21. data/{opal → corelib}/opal/regexp.rb +0 -0
  22. data/{opal → corelib}/opal/runtime.js +92 -126
  23. data/{opal → corelib}/opal/string.rb +14 -13
  24. data/{opal → corelib}/opal/time.rb +0 -0
  25. data/lib/opal.rb +9 -8
  26. data/lib/opal/builder.rb +81 -0
  27. data/lib/opal/erb.rb +17 -0
  28. data/lib/opal/grammar.rb +33 -30
  29. data/lib/opal/grammar.y +18 -15
  30. data/lib/opal/grammar_helpers.rb +5 -5
  31. data/lib/opal/lexer.rb +3 -2
  32. data/lib/opal/parser.rb +58 -41
  33. data/lib/opal/require_parser.rb +77 -0
  34. data/lib/opal/version.rb +1 -1
  35. data/opal.gemspec +1 -1
  36. data/{config.ru → spec/config.ru} +0 -0
  37. data/spec/opal/array/to_json_spec.rb +3 -1
  38. data/spec/opal/boolean/to_json_spec.rb +3 -1
  39. data/spec/opal/erb/erb_spec.rb +25 -0
  40. data/spec/opal/erb/quoted.opalerb +1 -0
  41. data/spec/opal/erb/simple.opalerb +1 -0
  42. data/spec/opal/json/parse_spec.rb +3 -1
  43. data/spec/opal/kernel/to_json_spec.rb +3 -1
  44. data/spec/opal/nil/to_json_spec.rb +3 -1
  45. data/spec/opal/string/to_json_spec.rb +3 -1
  46. data/spec/parser/int_spec.rb +13 -0
  47. data/spec/parser/regexp_spec.rb +16 -0
  48. data/spec/parser/str_spec.rb +11 -0
  49. data/spec/rubyspec/core/array/plus_spec.rb +7 -2
  50. data/spec/rubyspec/core/hash/to_json_spec.rb +3 -1
  51. data/spec/rubyspec/core/numeric/to_json_spec.rb +3 -1
  52. data/spec/rubyspec/language/defined_spec.rb +9 -0
  53. data/spec/rubyspec/library/stringscanner/pos_spec.rb +20 -0
  54. data/{opal → stdlib}/date.rb +0 -0
  55. data/stdlib/erb.rb +26 -0
  56. data/{opal → stdlib}/fileutils.rb +0 -0
  57. data/{opal → stdlib}/iconv.rb +0 -0
  58. data/{opal/opal → stdlib}/json.rb +0 -0
  59. data/{opal → stdlib}/observer.rb +0 -0
  60. data/{opal → stdlib}/opal-browser/local_storage.rb +0 -0
  61. data/{opal → stdlib}/opal-browser/script_loader.rb +1 -1
  62. data/{opal → stdlib}/opal-parser.js.erb +1 -1
  63. data/{opal → stdlib}/opal-source-maps.js.erb +0 -0
  64. data/{opal → stdlib}/pp.rb +0 -0
  65. data/{opal → stdlib}/racc.rb +0 -0
  66. data/{opal → stdlib}/rbconfig.rb +0 -0
  67. data/{opal → stdlib}/source_map.rb +1 -1
  68. data/{opal → stdlib}/source_map/generator.rb +0 -0
  69. data/{opal → stdlib}/source_map/parser.rb +0 -0
  70. data/{opal → stdlib}/source_map/vlq.rb +0 -0
  71. data/{opal → stdlib}/strscan.rb +15 -0
  72. data/{opal → stdlib}/yaml.rb +0 -0
  73. metadata +87 -77
  74. checksums.yaml +0 -7
  75. data/CHANGELOG.md +0 -176
  76. data/examples/native/Gemfile +0 -3
  77. data/examples/native/README.md +0 -17
  78. data/examples/native/app/app.rb +0 -57
  79. data/examples/native/config.ru +0 -8
  80. data/examples/native/index.html.erb +0 -12
  81. data/examples/rack/Gemfile +0 -3
  82. data/examples/rack/README.md +0 -22
  83. data/examples/rack/app/app.rb +0 -5
  84. data/examples/rack/config.ru +0 -20
  85. data/examples/rack/index.html +0 -12
  86. data/examples/server/Gemfile +0 -3
  87. data/examples/server/README.md +0 -22
  88. data/examples/server/app/app.rb +0 -18
  89. data/examples/server/config.ru +0 -10
  90. data/examples/server/index.html.erb +0 -10
  91. data/opal/opal-template.rb +0 -33
  92. data/spec/opal/class/_inherited_spec.rb +0 -32
  93. data/spec/opal/class/new_spec.rb +0 -27
@@ -259,8 +259,8 @@ module Opal
259
259
  ref
260
260
  when :ivar, :gvar, :cvar
261
261
  ref
262
- when :lit
263
- # this is when we passed __LINE__ which is converted into :lit
262
+ when :int
263
+ # this is when we passed __LINE__ which is converted into :int
264
264
  ref
265
265
  when :str
266
266
  # returns for __FILE__ as it is converted into str
@@ -301,7 +301,7 @@ module Opal
301
301
  return s(:nil) unless str
302
302
  case str[0]
303
303
  when :str
304
- str[0] = :lit
304
+ str[0] = :sym
305
305
  str[1] = str[1].to_sym
306
306
  when :dstr
307
307
  str[0] = :dsym
@@ -329,10 +329,10 @@ module Opal
329
329
  end
330
330
 
331
331
  def new_regexp(reg, ending)
332
- return s(:lit, //) unless reg
332
+ return s(:regexp, //) unless reg
333
333
  case reg[0]
334
334
  when :str
335
- s(:lit, Regexp.new(reg[1], ending))
335
+ s(:regexp, Regexp.new(reg[1], ending))
336
336
  when :evstr
337
337
  s(:dregx, "", reg)
338
338
  when :dstr
data/lib/opal/lexer.rb CHANGED
@@ -117,7 +117,8 @@ module Opal
117
117
  @lex_state = :expr_end
118
118
 
119
119
  if str_parse[:regexp]
120
- return :REGEXP_END, scanner.matched
120
+ result = scanner.scan(/\w+/)
121
+ return :REGEXP_END, result
121
122
  end
122
123
  return :STRING_END, scanner.matched
123
124
  else
@@ -576,7 +577,7 @@ module Opal
576
577
  @lex_state = :expr_end
577
578
  return '<<', '<<'
578
579
  elsif ![:expr_end, :expr_dot, :expr_endarg, :expr_class].include?(@lex_state) && space_seen
579
- if scanner.scan(/(-?)(\w+)/)
580
+ if scanner.scan(/(-?)['"]?(\w+)['"]?/)
580
581
  heredoc = scanner[2]
581
582
  # for now just scrap rest of line + skip down one line for
582
583
  # string content
data/lib/opal/parser.rb CHANGED
@@ -191,6 +191,7 @@ module Opal
191
191
  scope.line = sexp.line
192
192
 
193
193
  code = process(scope, :stmt)
194
+ code = [code] unless code.is_a? Array
194
195
  code.unshift fragment(@indent, sexp)
195
196
  }
196
197
 
@@ -198,7 +199,7 @@ module Opal
198
199
  @scope.add_temp "__scope = __opal"
199
200
  @scope.add_temp "$mm = __opal.mm"
200
201
  @scope.add_temp "nil = __opal.nil"
201
- @scope.add_temp "def = __opal.Object.prototype" if @scope.defines_defn
202
+ @scope.add_temp "def = __opal.Object._proto" if @scope.defines_defn
202
203
  @helpers.keys.each { |h| @scope.add_temp "__#{h} = __opal.#{h}" }
203
204
 
204
205
  vars = [fragment(INDENT, sexp), @scope.to_vars, fragment("\n", sexp)]
@@ -307,11 +308,11 @@ module Opal
307
308
  # of the format "process_<sexp_name>". Any sexp handler should
308
309
  # return a string of content.
309
310
  #
310
- # For example, calling `process` with `s(:lit, 42)` will call the
311
+ # For example, calling `process` with `s(:sym, 42)` will call the
311
312
  # method `#process_lit`. If a method with that name cannot be
312
313
  # found, then an error is raised.
313
314
  #
314
- # process(s(:lit, 42), :stmt)
315
+ # process(s(:int, 42), :stmt)
315
316
  # # => "42"
316
317
  #
317
318
  # @param [Array] sexp the sexp to process
@@ -413,7 +414,7 @@ module Opal
413
414
  # into a block sexp. A block sexp just holds any number of other
414
415
  # sexps.
415
416
  #
416
- # s(:block, s(:str, "hey"), s(:lit, 42))
417
+ # s(:block, s(:str, "hey"), s(:int, 42))
417
418
  #
418
419
  # A block can actually be empty. As opal requires real values to
419
420
  # be returned (to appease javascript values), a nil sexp
@@ -564,29 +565,31 @@ module Opal
564
565
  fragment((reverse ? "#{ name } === nil" : "#{ name } !== nil"), sexp)
565
566
  end
566
567
 
567
- # s(:lit, 1)
568
- # s(:lit, :foo)
569
- def process_lit(sexp, level)
570
- val = sexp.shift
571
- case val
572
- when Numeric
573
- if level == :recv
574
- fragment("(#{val.inspect})", sexp)
575
- else
576
- fragment(val.inspect, sexp)
577
- end
578
- when Symbol
579
- fragment(val.to_s.inspect, sexp)
580
- when Regexp
581
- fragment((val == // ? /^/.inspect : val.inspect), sexp)
582
- when Range
583
- @helpers[:range] = true
584
- "__range(#{val.begin}, #{val.end}, #{val.exclude_end?})"
568
+ def process_sym(sexp, level)
569
+ fragment(sexp[0].to_s.inspect, sexp)
570
+ end
571
+
572
+ def process_int(sexp, level)
573
+ handle_number sexp, level
574
+ end
575
+
576
+ def process_float(sexp, level)
577
+ handle_number sexp, level
578
+ end
579
+
580
+ def handle_number(sexp, level)
581
+ if level == :recv
582
+ fragment("(#{sexp[0]})", sexp)
585
583
  else
586
- raise "Bad lit: #{val.inspect}"
584
+ fragment(sexp[0].to_s, sexp)
587
585
  end
588
586
  end
589
587
 
588
+ def process_regexp(sexp, level)
589
+ val = sexp[0]
590
+ fragment((val == // ? /^/.inspect : val.inspect), sexp)
591
+ end
592
+
590
593
  def process_dregx(sexp, level)
591
594
  result = []
592
595
 
@@ -653,6 +656,8 @@ module Opal
653
656
  fragment("(__scope.#{part[1].to_s} != null)", sexp)
654
657
  when :colon2
655
658
  fragment("false", sexp)
659
+ when :colon3
660
+ fragment("(__opal.Object._scope.#{sexp[0][1]} == null ? nil : 'constant')", sexp)
656
661
  when :ivar
657
662
  ivar_name = part[1].to_s[1..-1]
658
663
  with_temp do |t|
@@ -739,7 +744,7 @@ module Opal
739
744
  code << process(body, :stmt)
740
745
 
741
746
  if @scope.defines_defn
742
- @scope.add_temp "def = ((typeof(#{current_self}) === 'function') ? #{current_self}.prototype : #{current_self})"
747
+ @scope.add_temp "def = ((#{current_self}._isClass) ? #{current_self}._proto : #{current_self})"
743
748
  end
744
749
 
745
750
  to_vars = [fragment("\n#@indent", sexp), @scope.to_vars, fragment("\n#@indent", sexp)]
@@ -782,7 +787,7 @@ module Opal
782
787
  # using the Module#attr_* methods as expected.
783
788
  #
784
789
  # @param [Symbol] meth :attr_{reader,writer,accessor}
785
- # @param [Array<Sexp>] attrs array of s(:lit) or s(:str)
790
+ # @param [Array<Sexp>] attrs array of s(:sym) or s(:str)
786
791
  # @return [String] precompiled attr methods
787
792
  def handle_attr_optimize(meth, attrs)
788
793
  out = []
@@ -880,8 +885,19 @@ module Opal
880
885
  result = dispatch
881
886
  else
882
887
  args = process arglist, :expr
883
- dispatch = tmprecv ? "(#{tmprecv} = #{recv_code})#{mid}" : "#{recv_code}#{mid}"
884
- result = splat ? "#{dispatch}.apply(#{tmprecv || recv_code}, #{args})" : "#{dispatch}(#{args})"
888
+
889
+ dispatch = if tmprecv
890
+ [fragment("(#{tmprecv} = ", sexp), recv_code, fragment(")#{mid}", sexp)]
891
+ else
892
+ [recv_code, fragment(mid, sexp)]
893
+ end
894
+
895
+ result = if splat
896
+ [dispatch, fragment(".apply(", sexp), (tmprecv ? fragment(tmprecv, sexp) : recv_code),
897
+ fragment(", ", sexp), args, fragment(")", sexp)]
898
+ else
899
+ [dispatch, fragment("(", sexp), args, fragment(")", sexp)]
900
+ end
885
901
  end
886
902
 
887
903
  @scope.queue_temp tmpfunc if tmpfunc
@@ -941,7 +957,7 @@ module Opal
941
957
  def process_splat(sexp, level)
942
958
  if sexp.first == [:nil]
943
959
  [fragment("[]", sexp)]
944
- elsif sexp.first.first == :lit
960
+ elsif sexp.first.first == :sym
945
961
  [fragment("[", sexp), process(sexp.first, :expr), fragment("]", sexp)]
946
962
  else
947
963
  process sexp.first, :recv
@@ -975,7 +991,7 @@ module Opal
975
991
  indent do
976
992
  in_scope(:class) do
977
993
  @scope.name = name
978
- @scope.add_temp "#{ @scope.proto } = #{name}.prototype", "__scope = #{name}._scope"
994
+ @scope.add_temp "#{ @scope.proto } = #{name}._proto", "__scope = #{name}._scope"
979
995
 
980
996
  if Array === body.last
981
997
  # A single statement will need a block
@@ -1019,7 +1035,7 @@ module Opal
1019
1035
 
1020
1036
  in_scope(:sclass) do
1021
1037
  @scope.add_temp "__scope = #{current_self}._scope"
1022
- @scope.add_temp "def = #{current_self}.prototype"
1038
+ @scope.add_temp "def = #{current_self}._proto"
1023
1039
 
1024
1040
  body = process body, :stmt
1025
1041
  code << @scope.to_vars << body
@@ -1055,7 +1071,7 @@ module Opal
1055
1071
  indent do
1056
1072
  in_scope(:module) do
1057
1073
  @scope.name = name
1058
- @scope.add_temp "#{ @scope.proto } = #{name}.prototype", "__scope = #{name}._scope"
1074
+ @scope.add_temp "#{ @scope.proto } = #{name}._proto", "__scope = #{name}._scope"
1059
1075
  body = process body, :stmt
1060
1076
 
1061
1077
  code << fragment(@indent, sexp)
@@ -1193,7 +1209,7 @@ module Opal
1193
1209
 
1194
1210
  if recvr
1195
1211
  if smethod
1196
- [fragment("__opal.defs(#{@scope.name}, '$#{mid}', ", sexp), result, fragment(")", sexp)]
1212
+ [fragment("#{@scope.name}.constructor.prototype['$#{mid}'] = ", sexp), result]
1197
1213
  else
1198
1214
  [recv, fragment("#{jsid} = ", sexp), result]
1199
1215
  end
@@ -1341,7 +1357,7 @@ module Opal
1341
1357
  end
1342
1358
  end
1343
1359
 
1344
- if keys.all? { |k| [:lit, :str].include? k[0] }
1360
+ if keys.all? { |k| [:sym, :str].include? k[0] }
1345
1361
  hash_obj = {}
1346
1362
  hash_keys = []
1347
1363
  keys.size.times do |i|
@@ -1454,7 +1470,7 @@ module Opal
1454
1470
 
1455
1471
  # alias foo bar
1456
1472
  #
1457
- # s(:alias, s(:lit, :foo), s(:lit, :bar))
1473
+ # s(:alias, s(:sym, :foo), s(:sym, :bar))
1458
1474
  def process_alias(exp, level)
1459
1475
  new = mid_to_jsid exp[0][1].to_s
1460
1476
  old = mid_to_jsid exp[1][1].to_s
@@ -1464,7 +1480,7 @@ module Opal
1464
1480
  fragment("%s%s = %s%s" % [@scope.proto, new, @scope.proto, old], exp)
1465
1481
  else
1466
1482
  current = current_self
1467
- fragment("%s.prototype%s = %s.prototype%s" % [current, new, current, old], exp)
1483
+ fragment("%s._proto%s = %s._proto%s" % [current, new, current, old], exp)
1468
1484
  end
1469
1485
  end
1470
1486
 
@@ -1494,9 +1510,10 @@ module Opal
1494
1510
  code << fragment(", ", sexp) unless code.empty?
1495
1511
 
1496
1512
  if l.first == :splat
1497
- s = l[1]
1498
- s << s(:js_tmp, "__slice.call(#{tmp}, #{idx})")
1499
- code << process(s, :expr)
1513
+ if s = l[1]
1514
+ s << s(:js_tmp, "__slice.call(#{tmp}, #{idx})")
1515
+ code << process(s, :expr)
1516
+ end
1500
1517
  else
1501
1518
  if idx >= len
1502
1519
  l << s(:js_tmp, "(#{tmp}[#{idx}] == null ? nil : #{tmp}[#{idx}])")
@@ -2038,19 +2055,19 @@ module Opal
2038
2055
 
2039
2056
  elsif @scope.type == :def
2040
2057
  @scope.identify!
2041
- cls_name = @scope.parent.name || "#{current_self}.constructor.prototype"
2058
+ cls_name = @scope.parent.name || "#{current_self}._klass._proto"
2042
2059
  jsid = mid_to_jsid @scope.mid.to_s
2043
2060
 
2044
2061
  if @scope.defs
2045
2062
  [fragment(("%s._super%s.apply(this, " % [cls_name, jsid]), sexp), args, fragment(")", sexp)]
2046
2063
  else
2047
- [fragment("#{current_self}.constructor._super.prototype#{jsid}.apply(#{current_self}, ", sexp), args, fragment(")", sexp)]
2064
+ [fragment("#{current_self}._klass._super._proto#{jsid}.apply(#{current_self}, ", sexp), args, fragment(")", sexp)]
2048
2065
  end
2049
2066
 
2050
2067
  elsif @scope.type == :iter
2051
2068
  chain, defn, mid = @scope.get_super_chain
2052
2069
  trys = chain.map { |c| "#{c}._sup" }.join ' || '
2053
- [fragment("(#{trys} || #{current_self}.constructor._super.prototype[#{mid}]).apply(#{current_self}, ", sexp), args, fragment(")", sexp)]
2070
+ [fragment("(#{trys} || #{current_self}._klass._super._proto[#{mid}]).apply(#{current_self}, ", sexp), args, fragment(")", sexp)]
2054
2071
  else
2055
2072
  raise "Cannot call super() from outside a method block"
2056
2073
  end
@@ -0,0 +1,77 @@
1
+ require 'opal/parser'
2
+
3
+ module Opal
4
+ # A parser which collects all require() statments for dependency building
5
+ class RequireParser < Parser
6
+ def self.parse source, options = {}
7
+ self.new.parse source, options
8
+ end
9
+
10
+ # Holds an array of paths which this file 'requires'.
11
+ # @return Array<String>
12
+ attr_reader :requires
13
+
14
+ def parse source, options = {}
15
+ @requires = []
16
+ @dynamic_require_severity = (options[:dynamic_require_severity] || :error)
17
+ super source, options
18
+ end
19
+
20
+ def process_call sexp, level
21
+ if sexp[1] == :require
22
+ return handle_require sexp[2][1]
23
+ end
24
+
25
+ super sexp, level
26
+ end
27
+
28
+ def handle_require(sexp)
29
+ str = handle_require_sexp sexp
30
+ @requires << str unless str.nil? if @requires
31
+ fragment("", sexp)
32
+ end
33
+
34
+ def handle_require_sexp(sexp)
35
+ type = sexp.shift
36
+
37
+ if type == :str
38
+ return sexp[0]
39
+ elsif type == :call
40
+ recv, meth, args = sexp
41
+ parts = args[1..-1].map { |s| handle_require_sexp s }
42
+
43
+ if recv == [:const, :File]
44
+ if meth == :expand_path
45
+ return handle_expand_path(*parts)
46
+ elsif meth == :join
47
+ return handle_expand_path parts.join("/")
48
+ elsif meth == :dirname
49
+ return handle_expand_path parts[0].split("/")[0...-1].join("/")
50
+ end
51
+ end
52
+ end
53
+
54
+
55
+ case @dynamic_require_severity
56
+ when :error
57
+ error "Cannot handle dynamic require"
58
+ when :warning
59
+ warning "Cannot handle dynamic require"
60
+ end
61
+ end
62
+
63
+ def handle_expand_path(path, base = '')
64
+ "#{base}/#{path}".split("/").inject([]) do |p, part|
65
+ if part == ''
66
+ # we had '//', so ignore
67
+ elsif part == '..'
68
+ p.pop
69
+ else
70
+ p << part
71
+ end
72
+
73
+ p
74
+ end.join "/"
75
+ end
76
+ end
77
+ end
data/lib/opal/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Opal
2
- VERSION = '0.4.2'
2
+ VERSION = '0.4.3'
3
3
  end
data/opal.gemspec CHANGED
@@ -21,5 +21,5 @@ Gem::Specification.new do |s|
21
21
  s.add_development_dependency 'uglifier'
22
22
  s.add_development_dependency 'rake'
23
23
  s.add_development_dependency 'racc'
24
- s.add_development_dependency 'opal-sprockets', '~> 0.1.0'
24
+ s.add_development_dependency 'opal-sprockets', '~> 0.1.1'
25
25
  end
File without changes
@@ -1,7 +1,9 @@
1
+ require 'json'
2
+
1
3
  describe "Array#to_json" do
2
4
  it "returns a string of all array elements converted to json" do
3
5
  [].to_json.should == "[]"
4
6
  [1, 2, 3].to_json.should == "[1, 2, 3]"
5
7
  [true, nil, false, "3", 42].to_json.should == '[true, null, false, "3", 42]'
6
8
  end
7
- end
9
+ end
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  describe "Boolean#to_json" do
2
4
  it "returns 'true' when true" do
3
5
  true.to_json.should == "true"
@@ -6,4 +8,4 @@ describe "Boolean#to_json" do
6
8
  it "returns 'false' when false" do
7
9
  false.to_json.should == "false"
8
10
  end
9
- end
11
+ end
@@ -0,0 +1,25 @@
1
+ require 'erb'
2
+
3
+ require File.expand_path('../simple', __FILE__)
4
+ require File.expand_path('../quoted', __FILE__)
5
+
6
+ describe "ERB files" do
7
+ before :each do
8
+ @simple = Template['opal/erb/simple']
9
+ @quoted = Template['opal/erb/quoted']
10
+ end
11
+
12
+ it "should be defined by their filename on Template namespace" do
13
+ @simple.should be_kind_of(ERB)
14
+ end
15
+
16
+ it "calling the block with a context should render the block" do
17
+ @some_data = "hello"
18
+ @simple.render(self).should == "<div>hello</div>\n"
19
+ end
20
+
21
+ it "should accept quotes in strings" do
22
+ @name = "adam"
23
+ @quoted.render(self).should == "<div class=\"foo\">hello there adam</div>\n"
24
+ end
25
+ end
@@ -0,0 +1 @@
1
+ <div class="foo">hello <%= "there " + @name %></div>
@@ -0,0 +1 @@
1
+ <div><%= @some_data %></div>
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  describe "JSON.parse" do
2
4
  it "parses null into nil" do
3
5
  JSON.parse("null").should be_nil
@@ -28,4 +30,4 @@ describe "JSON.parse" do
28
30
  JSON.parse('{"a": "b"}').should == {"a" => "b"}
29
31
  JSON.parse('{"a": null, "b": 10, "c": [true, false]}').should == {"a" => nil, "b" => 10, "c" => [true, false]}
30
32
  end
31
- end
33
+ end