summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2020-12-23[ruby/psych] Optimize cache with `compare_by_identity`Marc-Andre Lafortune
Using `compare_by_identity` gives a 4x performance boost on cache hits. Benchmark in https://github.com/JuanitoFatas/fast-ruby/issues/189
2020-12-23[ruby/psych] Make Ractor-ready.Marc-Andre Lafortune
Config is Ractor-local. Benchmarking reveals that using `Ractor.local_storage` for storing cache is similar to accessing a constant (~15% slower).
2020-11-12Add `Psych.safe_load_file`. Tweak doc to provide `safe_` examples.Marc-Andre Lafortune
2020-09-10Forward keyword arguments in load_file and load_streamJean Boussier
2020-07-16Remove private_iv_getCharles Oliver Nutter
The only remaining use of this function was to get the internal message object from an exception's hidden `mesg` instance variable to allow it to be dumped wiithout converting to a string. As discussed in #103, this exposes internal implementation details of CRuby, and ultimately does not provide any real utility to the user since they can't directly inspect this hidden variable. The test change here is to reflect CRuby behavior that denies equality if the internal message objects do not match, as is the case after the exception has been loaded and now has a simple String value. The impact to users is that exceptions with special hidden message objects will convert those objects to String during marshaling through YAML. I believe this only affects NameError and its descendants, since users can't set this field directly on their own exception types. Fixes #103.
2020-06-23Fix remove warning & support multi-run test for ↵S-H-GAMELINKS
test/psych/visitors/test_to_ruby.rb
2020-06-23remove warning & support multi-run test for test/psych_test_yaml.rb (#2887)S.H
2020-06-23remove warning & support multi-run test for ↵S.H
test/psych/visitors/test_to_ruby.rb (#2881)
2020-06-08Fix anchor lookup with symbolized namesJean Boussier
2020-06-03Merge pull request #438 from mthorn/masterAaron Patterson
Fix ArgumentError with leading and trailing underscores in number str…
2020-06-03Fixing compatibility with libyaml 0.2.5Aaron Patterson
The main issue is that commas aren't allowed in local tags. libyaml was updated to follow the spec, and our tests were out of date. See: https://github.com/yaml/libyaml/issues/196
2020-03-03Fix ArgumentError with leading and trailing underscores in number strings.Mark Thorn
2019-11-28Implement `freeze` option for Pysch.loadJean Boussier
2019-10-21Remove taint supportJeremy Evans
Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. I'm not sure if the untaint calls in deduplicate are still needed after the removal of tainting in the parser. If they are not needed, they should be removed.
2019-07-25Suppress uninitialized instance variable warningsNobuyoshi Nakada
In verbose mode, `test_delegator` in `test/psych/visitors/test_yaml_tree.rb` shows following warning. https://travis-ci.org/ruby/psych/jobs/562435717#L268 ``` /home/travis/build/ruby/psych/test/psych/visitors/test_yaml_tree.rb:10: warning: instance variable @obj not initialized ``` This is because `Psych.load` bypasses #initialize with the #init_with method.
2019-07-22Deduplicate hash keys if they're stringsJean Boussier
2019-04-26Do not allocate a string to check if a scalar is an integerJean Boussier
2019-01-16Add test to demonstrate issue deserializing hash with ivarJordan Owens
Currently the elements of a hash are revived before any ivar values. This causes an issue when the `[]=` method references an instance variable.
2019-01-09Round trip exception backtracesAaron Patterson
This commit allows exception backtraces to round trip
2018-11-10Use friendlier terminology in YAML.safe_loadJuanito Fatas
Replace keyword argumment whitelist_classes and whitelist_symbols. with permitted_classes and permitted_symbols.
2018-10-20Avoid to warnings for deprecated interfaces.SHIBATA Hiroshi
2018-09-18Put parentheses before minus operator.SHIBATA Hiroshi
2018-09-18Prefer to use assert_nilSHIBATA Hiroshi
2018-07-13unifying interface of PsychGreg Houle
2018-07-12Added tests for special cases and better overall API test coverageGreg Houle
2018-04-24Add test cases for fallback argument of Psych.loadMarcus Stollsteimer
2018-04-24Add more test cases for fallback of Psych.load_fileMarcus Stollsteimer
Add test cases for the fallback keyword argument of Psych.load_file to make sure that a falsy fallback (nil or false) works properly.
2018-04-23Add more test cases for fallback of Psych.load_fileMarcus Stollsteimer
Add test cases for the fallback keyword argument of Psych.load_file to make sure that the fallback is not used for valid YAML that represents nil or false.
2017-12-20Add a predicate method to each nodeAaron Patterson
This allows the AST to be searched via a predicate method rather than hardcoding the class name and doing is_a? checks. For example, rather than: ``` ast.grep(Psych::Nodes::Scalar).each do |node| # .. do something end ``` Now you can do: ``` ast.find_all(&:scalar?).each do |node| # .. do something end ``` Your code no longer needs to know the exact class used in the AST.
2017-12-19Add more test cases for fallback of Psych.load_fileMarcus Stollsteimer
Add more test cases for the fallback keyword argument of Psych.load_file; additionally, fix an error in the docs.
2017-12-02Convert fallback option to a keyword argumentMarcus Stollsteimer
Converting the optional fallback argument to a keyword argument fixes a problem that is caused by mixing optional arguments and optional keyword arguments. Without this change, a hash as fallback value is not handled correctly: in Psych.load("", nil, {}) the hash is not interpreted as the fallback value, and the default value for the fallback argument is used instead.
2017-11-30Add :symbolize_names option to .safe_load tooTakashi Kokubun
related to #333
2017-11-29Revert "Double quote stings that contain single quotes only"SHIBATA Hiroshi
2017-11-25Add :symbolize_names option to Psych.loadTakashi Kokubun
like JSON.parse.
2017-09-12Removed trailing white-spaces.SHIBATA Hiroshi
2017-09-11Merge pull request #325 from knugie/fix_324SHIBATA Hiroshi
Double quote stings that contain single quotes only
2017-09-10Merge pull request #326 from asterite/feature/scalar_locationAaron Patterson
Add Psych::Handler#event_location
2017-09-05Parse.load with an IO/File which has a non-YAML allowed encoding will justThomas E. Enebo
set the encoding to UTF-8 and hope for the best. This appears to be how libyaml works. This issue was noticed in yaml/store because it extends pstore which will create an IO in read_only mode as: ```ruby RD_ACCESS = {mode: IO::RDONLY | IO::BINARY, encoding: Encoding::ASCII_8BIT} ``` The data in the test case I was debugging was in fact UTF-8 data and MRI was happy to take this 8bit IO and pretend it is UTF-8. Form-fitting ftw.
2017-08-02Add location information to Psych::Nodes::NodeAry Borenszweig
2017-08-02Add Psych::Handler#event_locationAry Borenszweig
This adds a new reported event to Psych::Handler, event_location, with precise start/end line/column information. The line/column information provided by Psych::Parser#mark is not very useful because it points to the location past the event.
2017-07-21Double quote stings that contain single quotes onlyWolfgang Teuber
Fixes #324
2017-06-30Merge branch 'master' into frozenSHIBATA Hiroshi
2017-06-29Support enumerator objectsAaron Patterson
Fixes #277
2017-06-29Rely on encoding tags to determine if string should be dumped as binaryAaron Patterson
If a string is tagged as binary, then we should dump it as binary. Fixes #278
2017-06-19make frozen_string_literal: trueSHIBATA Hiroshi
2017-06-16Merge pull request #158 from laserlemon/delegatorsSHIBATA Hiroshi
Enable YAML serialization of Ruby delegators
2017-05-22Preserve time zone offset when deserializing timesMarcus Stollsteimer
Fix support of time zone offsets. Now the time zone offset will be preserved when times are deserialized from YAML with a specified offset. Previously, times other than UTC ("Z") where converted to local time. The test cases use two different offsets to account for the possibility of an erratic success when the tests are run in the corresponding time zone.
2017-05-22Add tests for time with usec and with time zone offsetMarcus Stollsteimer
Add test cases for times with nonzero usec, and for times other than UTC. Note that in the latter case the test only ensures that the restored time designates the same point in time, not that is has the same time zone offset.
2017-03-27Fixed gabage linesSHIBATA Hiroshi
2017-03-27Removed deprecated yaml_initialize methodSHIBATA Hiroshi